Class: authentication

authentication()

new authentication()

Authentication API Controller

Author:
  • Calvin Ho
Source:

Methods

(static) checkToken(req, res, next) → {Object}

Checks JWT Token

Parameters:
Name Type Description
req
res
next
Author:
  • Calvin Ho
Source:
Returns:

returns success status

Type
Object

(static) login(req, res, next) → {Object}

Authenticates user login

Parameters:
Name Type Description
req
res
next
Author:
  • Calvin Ho
Source:
Returns:

returns object with JWT token and user

Type
Object

(static) recoverPassword(req, res, next) → {Object}

Sends verification email and then if valid recovery url will update password

Parameters:
Name Type Description
req
res
next
Author:
  • Calvin Ho
Source:
Returns:

sends verification email object as well as status if password successfully changed

Type
Object

(static) registerEmail(req, res, next) → {Object}

Step 1 - In registration via email. An email is sent to the user inbox. Upon clicking on the email, it will load the webapp showfeature.ts, which will process the verification token.

Parameters:
Name Type Description
req
res
next
Author:
  • Calvin Ho
Source:
Returns:

sends verification email object

Type
Object

(static) registerMobile(req, res, next) → {Object}

Runs some validation on number, registers phone number and sends a verification text

Parameters:
Name Type Description
req
res
next
Author:
  • Calvin Ho
Source:
Returns:

Sends status messages regarding phone number validation

Type
Object

(static) roleAuthorization(roles) → {Object}

Checks if role is authorized for action

Parameters:
Name Type Description
roles
Author:
  • Calvin Ho
Source:
Returns:

Status of authorization check

Type
Object

(static) saveURLSendVerificationEmail(userId, name, email) → {Object}

Sends recovery URL in separate email

Parameters:
Name Type Description
userId
name
email
Author:
  • Calvin Ho
Source:
Returns:

sends status of sending recovery url email

Type
Object

(static) verifyEmailVerificationToken(req, res, next) → {Object}

Step 2. In registration via email. Upon being called by the webapp to verify token, it authenticates the user and emit socket io to refresh webapp to load authenticated user

Parameters:
Name Type Description
req
res
next
Author:
  • Calvin Ho
Source:
Returns:

returns token and success status

Type
Object

(static) verifyMobile(req, res, next) → {Object}

Verifies that One-Time-Password is correct for user

Parameters:
Name Type Description
req
res
next
Author:
  • Calvin Ho
Source:
Returns:

returns success status and user object

Type
Object