Skip to main content

DefaultPasswordValidationStrategy

DefaultPasswordValidationStrategy

The DefaultPasswordValidationStrategy allows you to specify a minimum length and/or a regular expression to match passwords against.

TODO: By default, the minLength will be set to 4. This is rather permissive and is only this way in order to reduce the risk of backward-compatibility breaks. In the next major version this default will be made more strict.

Signature
class DefaultPasswordValidationStrategy implements PasswordValidationStrategy {
constructor(options: { minLength?: number; regexp?: RegExp })
validate(ctx: RequestContext, password: string) => boolean | string;
}

constructor

method
(options: { minLength?: number; regexp?: RegExp }) => DefaultPasswordValidationStrategy

validate

method
(ctx: RequestContext, password: string) => boolean | string