AccountsPasswordOptions
Index
Properties
- errors
- hashPassword
- invalidateAllSessionsAfterPasswordChanged
- invalidateAllSessionsAfterPasswordReset
- notifyUserAfterPasswordChanged
- passwordEnrollTokenExpiration
- passwordResetTokenExpiration
- removeAllResetPasswordTokensAfterPasswordChanged
- requireEmailVerification
- returnTokensAfterResetPassword
- sendVerificationEmailAfterSignup
- twoFactor
- validateEmail
- validateNewUser
- validatePassword
- validateUsername
- verifyEmailTokenExpiration
- verifyPassword
Properties
optionalerrors
optionalhashPassword
Type declaration
Function called to hash the user password, the password returned will be saved in the database directly. By default we use bcrypt to hash the password. Use this option alongside
verifyPassword
if you want to use argon2 for example.Parameters
password: string
Returns Promise<string>
optionalinvalidateAllSessionsAfterPasswordChanged
Invalidate existing sessions after password has been changed Default to false.
optionalinvalidateAllSessionsAfterPasswordReset
Invalidate existing sessions after password has been reset Default to true.
optionalnotifyUserAfterPasswordChanged
Notify a user after his password has been changed. This email is sent when the user reset his password and when he change it. Default to true.
optionalpasswordEnrollTokenExpiration
The number of milliseconds from when a link to set inital password is sent until token expires and user can't set password with the link anymore. Defaults to 30 days.
optionalpasswordResetTokenExpiration
The number of milliseconds from when a link to reset password is sent until token expires and user can't reset password with the link anymore. Defaults to 3 days.
optionalremoveAllResetPasswordTokensAfterPasswordChanged
Will remove all password reset tokens from the db after a password has been changed. Default to true.
optionalrequireEmailVerification
Whether the email needs to be verified in order to allow authentication. From an user enumeration perspective changes what is safe to return when ambiguousErrorMessages are enabled. Can be enabled only if enableAutologin is set to false. Defaults to false.
optionalreturnTokensAfterResetPassword
Default to false.
optionalsendVerificationEmailAfterSignup
Will automatically send a verification email after signup. Default to false.
optionaltwoFactor
Two factor options passed down to the @accounts/two-factor service.
optionalvalidateEmail
Type declaration
Function that check if the email is a valid email. This function will be called when you call
createUser
andaddEmail
.Parameters
optionalemail: string
Returns boolean
optionalvalidateNewUser
Type declaration
Function that will validate the user object during
createUser
. The user returned from this function will be directly inserted in the database so be careful when you whitelist the fields, By default we only allowusername
,email
andpassword
fields.Parameters
user: CreateUserServicePassword
Returns CreateUserServicePassword | Promise<CreateUserServicePassword>
optionalvalidatePassword
Type declaration
Function that check if the password is valid. This function will be called when you call
createUser
andchangePassword
.Type parameters
- T: User
Parameters
optionalpassword: string
optionaluser: T
Returns Promise<boolean>
optionalvalidateUsername
Type declaration
Function that check if the username is a valid username. This function will be called when you call
createUser
.Parameters
optionalusername: string
Returns boolean
optionalverifyEmailTokenExpiration
The number of milliseconds from when a link to verify the user email is sent until token expires and user can't verify his email with the link anymore. Defaults to 3 days.
optionalverifyPassword
Type declaration
Function called to verify the password hash. By default we use bcrypt to hash the password. Use this option alongside
hashPassword
if you want to use argon2 for example.Parameters
password: string
hash: string
Returns Promise<boolean>
Accounts password module errors