You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* encoding: specifies the encoding the generated salt and hash will be stored in. Defaults to 'hex'.
134
134
* limitAttempts: specifies whether login attempts should be limited and login failures should be penalized. Default: false.
135
135
* maxAttempts: specifies the maximum number of failed attempts allowed before preventing login. Default: Infinity.
136
-
* passwordValidator: specifies your custom validation function for the password in the form 'function(password,cb)'. Default: validates non-empty passwords.
136
+
* passwordValidator: specifies your custom validation function for the password in the form:
137
+
```
138
+
passwordValidator = function(password,cb) {
139
+
if (someValidationErrorExists(password)) {
140
+
return cb('this is my custom validation error message')
141
+
}
142
+
// return an empty cb() on success
143
+
return cb()
144
+
}
145
+
```
146
+
Default: validates non-empty passwords.
147
+
* passwordValidatorAsync: specifies your custom validation function for the password with promises in the form:
148
+
```
149
+
passwordValidatorAsync = function(password) {
150
+
return someAsyncValidation(password)
151
+
.catch(function(err){
152
+
return Promise.reject(err)
153
+
})
154
+
}
155
+
```
137
156
* usernameQueryFields: specifies alternative fields of the model for identifying a user (e.g. email).
138
157
* findByUsername: Specifies a query function that is executed with query parameters to restrict the query with extra query parameters. For example query only users with field "active" set to `true`. Default: `function(model, queryParameters) { return model.findOne(queryParameters); }`. See the examples section for a use case.
0 commit comments