LocalAuthModule

localauth. LocalAuthModule

Module which implements username/password (local) authentication

Constructor

new LocalAuthModule()

Source:

Extends

  • AbstractAuthModule

Members

users :UsersModule

Description:
  • Local reference to the current UsersModule instance for convenience
Source:
Local reference to the current UsersModule instance for convenience
Type:
  • UsersModule

Methods

(async) authenticate()

Source:

(async) changePasswordHandler(req, res, next)

Description:
  • Handles changing a user password. If no auth is given, a reset token must be present
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) createPasswordReset(email, subject, textContent, htmlContent, lifespan)

Description:
  • Creates a new password reset token and sends an email
Source:
Parameters:
Name Type Description
email String
subject String
textContent String
htmlContent String
lifespan Number The lifespan of the reset

(async) forgotPasswordHandler(req, res, next)

Description:
  • Handles sending a user password reset
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) handleLockStatus(req, user)

Description:
  • Checks if the user account is currently locked, and unlocks a temporarily locked account if appropriate
Source:
Parameters:
Name Type Description
req external:ExpressRequest
user Object The current user

(async) init()

Source:

(async) inviteHandler(req, res, next)

Description:
  • Handles inviting a new user to the system
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) register()

Source:

(async) registerSuperHandler(req, res, next)

Description:
  • Registers a Super User. This is restricted to localhost, and can only be used to create the first Super User.
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) setUserEnabled()

Source:

(async) setValues()

Source:

(async) updateUser(req, userIdOrQuery, updateData) → {Promise}

Description:
  • Updates a single user
Source:
Parameters:
Name Type Description
req external:ExpressRequest
userIdOrQuery String | ObjectId | Object Accepts a user _id or a query object
updateData Object JSON data to use for update
Returns:
Type
Promise

(async) validatePasswordHandler(req, res, next)

Description:
  • Handles changing a user password. If no auth is given, a reset token must be present
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(static) formatRemainingTime(secs)

Description:
  • Returns a human-readable string to denote how many seconds are remaining
Source:
Parameters:
Name Type Description
secs Number The remaining seconds