Members
Methods
# inner comparePassword(password) → {boolean}
This method is used to compare the user password with the password.
Parameters:
Name | Type | Description |
---|---|---|
password |
string
|
boolean
# inner updatePassword(newPassword)
This method is used to update the user password. it first hashes the new password and then saves it to the database.
Parameters:
Name | Type | Description |
---|---|---|
newPassword |
string
|
Type Definitions
Object
# authCodeSchema
This schema is used to store verification codes for user authentication, such as the verification code for email verification, the password reset code.
NOTE: The activation and deactivation codes are only used for superadmin account activation and deactivation.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
user |
ObjectId
|
The user to whom the code belongs |
|
verification_code |
String
|
The verification code |
|
password_reset_code |
String
|
The password reset code |
|
activation_code |
String
|
<optional> |
The account activation code, for superadmin account activation |
deactivation_code |
String
|
<optional> |
The account deactivation code, for superadmin account deactivation |
createdAt |
Date
|
The date the code was created |
Object
# blacklistedTokenSchema
This schema is used to store blacklisted JWT tokens, so that they can be checked against when a user tries to access a protected route
NOTE: The token expiry is set to the same as the refresh token expiry. because the no valid JWT will last longer than the refresh token. This value can be modified in the config file.
Properties:
Name | Type | Description |
---|---|---|
token |
String
|
The blacklisted token |
createdAt |
Date
|
The date the token was blacklisted |
expiresAt |
Date
|
The date the token will expire, |
Object
# passwordSchema
This schema is used to store user passwords.
NOTE: The password is hashed before being stored in the database.
Properties:
Name | Type | Description |
---|---|---|
password |
String
|
The user password |
user |
ObjectId
|
The user to whom the password belongs |