3.0.12 • Published 3 years ago

@kano/kwc-auth v3.0.12

Weekly downloads
5
License
-
Repository
-
Last release
3 years ago

\<kwc-auth>

Purpose

Front end for Kano's authentication flow.

27/02/2019: Starting refactor to allow for new GDPR and COPPA compliant flow. This will involve the following tasks:

  • remove unnecessary properties
  • remove unnecessary styles
  • Align with brand styles
  • Remove Polymer dependency
  • Add lit-html dependency
  • Investigation on need for typescript
  • Remove Behaviour dep
  • Move behaviour / validation into utility
  • Ensure tabbing and accessability is as expected
  • Show/hide password feature
  • Check username available on blur
  • Validation of other inputs on blur

24/05/2018: The README is out of date. Please proceed with caution.

This component implements view according to the current User Login Journey as descibe in this working document. Please note this link is not guarenteed to be in sync with the component but should be a good guide.

Properties

API

kwc-auth#reset()

Reset the internal state of the auth modal. Essentially

kwc-auth#show*

Auth Flows and Views

This component is very specific to the authentication flow as it is currently specified for the kano apps. It does not contain any logic for completing the authentication flows, that is defered the the context in which the component is used. The views are for collecting the relevant user data so any parent (probably app specific) component can complete the communicaiton with the api and process any responses.

Login | Signup

login

signup

grownups

Forget credentials

The kwc-auth component implements two views to allow a user to enter information in order to recover forgotten credentials. Username recovery flow accepts a valid email address and password recovery asks for a username. (See here for more detail.)

password-reset

username-reminder

cancel

This event is fired when the modal close button or the skip button are clicked.

change-*

kw-auth exposes the on-change-[email|firstname|password|username] events for the input fields on the auth forms. This allows for parent components to apply context specific validations on user inputs. For example we could check username availability as a user types.

const authElem = document.querySelector('#auth');
authElm.addEventListener('change-username', (e) => {

    if(this.delayTimer){
        clearTimeout(this.delayTimer);
    }
    this.delayTimer = setTimeout((function(value) {
        return fetch(`${API_URL}/users/username/${value}`)
            .then((res) => {
                if(res.ok){
                    authElm.errors.username = "This one is already taken."
                }
            });
        },
    }).bind( this, e.detail ), 1000);
});

The detail property of the event will contain only the current value of the targeted input.

done

Fired when the done button is clicked on the final auth modal view. No data is passed.

forgot-password

The event is passed the following detail:

{
    type: 'object',
    properties: {
        username: {
            type: 'string'
        }
    }
}

forgot-username

The event is passed the following detail:

{
    type: 'object',
    properties: {
        password: {
            type: 'string'
        }
    }
}

login

The event is passed the following detail:

{
    type: 'object',
    properties: {
        username: {
            type: 'string'
        },
        password: {
            type: 'string'
        }
    }
}

skip

The event is passed no data and is followed by a cancel event.

submit-signup-email

The event is passed the following detail:

{
    type: 'object',
    properties: {
        firstName: {
            type: 'string'
        },
        username: {
            type: 'string'
        },
        password: {
            type: 'string'
        },
        email: {
            type: 'string',
            format: 'email'
        },
        newsletter: {
            type: 'boolean'
        }
    }
}

submit-signup-info

The event is passed the following detail:

{
    type: 'object',
    properties: {
        firstName: {
            type: 'string'
        },
        username: {
            type: 'string'
        },
        password: {
            type: 'string'
        }
    }
} -->

Installation

  • Clone this repository.
  • Run yarn

  • To serve locally yarn serve - the site will be served on http://localhost:4000/demo

  • If you'd like to change the port that it's running on use yarn serve --port=4040

  • yarn add --dev typescript

  • Watch file changes: yarn tsc --watch

Running Tests

$ yarn test

or to serve your tests while you work

$ yarn serve-test
3.0.12

3 years ago

3.0.11

3 years ago

3.0.10

3 years ago

3.0.9

4 years ago

3.0.8

4 years ago

3.0.7

4 years ago

3.0.6

4 years ago

3.0.4

4 years ago

3.0.5

4 years ago

3.0.3

4 years ago

1.0.0

4 years ago

4.0.0-alpha.17

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

4.0.0-alpha.16

4 years ago

4.0.0-alpha.15

4 years ago

4.0.0-alpha.14

4 years ago

4.0.0-alpha.13

5 years ago

4.0.0-alpha.12

5 years ago

4.0.0-alpha.11

5 years ago

4.0.0-alpha.10

5 years ago

4.0.0-alpha.9

5 years ago

4.0.0-alpha.8

5 years ago

4.0.0-alpha.7

5 years ago

4.0.0-alpha.6

5 years ago

4.0.0-alpha.5

5 years ago

4.0.0-alpha.4

5 years ago

4.0.0-alpha.3

5 years ago

4.0.0-alpha.2

5 years ago

4.0.0-alpha.1

5 years ago

3.0.0-beta.18

5 years ago

3.0.0-beta.17

6 years ago

3.0.0-beta.16

6 years ago

3.0.0-beta.15

6 years ago

3.0.0-beta.14

6 years ago

3.0.0-beta.13

6 years ago

3.0.0-beta.12

6 years ago

3.0.0-beta.11

6 years ago

3.0.0-beta.10

6 years ago

3.0.0-beta.9

6 years ago

3.0.0-beta.8

6 years ago

3.0.0-beta.7

6 years ago

3.0.0-beta.6

6 years ago

3.0.0-beta.5

6 years ago

3.0.0-beta.4

6 years ago

3.0.0-beta.3

6 years ago

3.0.0-beta.2

6 years ago

3.0.0-beta.1

6 years ago