Wt: Wt::Auth::AbstractPasswordService::AbstractStrengthValidator Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Wt::Auth::AbstractPasswordService::AbstractStrengthValidator Class Referenceabstract

Validator for password strength. More...

`#include <AbstractPasswordService.h>`

Inheritance diagram for Wt::Auth::AbstractPasswordService::AbstractStrengthValidator:
[legend]

## Public Member Functions
| AbstractStrengthValidator ()
| Constructor.
virtual StrengthValidatorResult | evaluateStrength (const WString &password, const WString &loginName, const std::string &email) const =0
| Evaluates the strength of a password.
virtual Result | validate (const WString &password, const WString &loginName, const std::string &email) const
| Validates a password.
virtual Result | validate (const WString &password) const override
| Validates a password.
Public Member Functions inherited from Wt::WValidator
| WValidator (bool mandatory=false)
| Creates a new validator.
virtual | ~WValidator ()
| Destructor.
void | setMandatory (bool how)
| Sets if input is mandatory.
bool | isMandatory () const
| Returns if input is mandatory.
void | setInvalidBlankText (const WString &text)
| Sets the message to display when a mandatory field is left blank.
WString | invalidBlankText () const
| Returns the message displayed when a mandatory field is left blank.
virtual WString | format () const
| Returns the validator format.
virtual std::string | javaScriptValidate () const
| Creates a Javascript object that validates the input.
virtual std::string | inputFilter () const
| Returns a regular expression that filters input.

## Additional Inherited Members
Public Types inherited from Wt::WValidator
typedef ValidationState | State
| Typedef for enum Wt::ValidationState.
Protected Member Functions inherited from Wt::WValidator

## Detailed Description

Validator for password strength.

This class defines a specialized validator interface for evaluating password strength. The implementation allows to evaluate strength in addition to the normal validator functionality of validating a password.

The evaluateStrength() computes the strength and returns an instance of StrenghtValidatorResult which contains information on the validity and the strength of the password together with possible messages.

See also
  strengthValidator()

## Member Function Documentation

## ◆ evaluateStrength()

virtual StrengthValidatorResult Wt::Auth::AbstractPasswordService::AbstractStrengthValidator::evaluateStrength | ( | const WString & | password,
|  | const WString & | loginName,
|  | const std::string & | email ) const
| pure virtual

Evaluates the strength of a password.

The result is an instance of StrengthValidatorResult which contains information on the validity and the strength of the password together with possible messages.

The validator may take into account the user's login name and email address, to exclude passwords that are too similar to these.

Implemented in Wt::Auth::PasswordStrengthValidator.

## ◆ validate() [1/2]

virtual Result Wt::Auth::AbstractPasswordService::AbstractStrengthValidator::validate | ( | const WString & | password | ) | const
| overridevirtual

Validates a password.

Calls validate(password, WString::Empty, "");

Reimplemented from Wt::WValidator.

## ◆ validate() [2/2]

virtual Result Wt::Auth::AbstractPasswordService::AbstractStrengthValidator::validate | ( | const WString & | password,
|  | const WString & | loginName,
|  | const std::string & | email ) const
| virtual

Validates a password.

This uses evaluateStrength(), isValid() and message() to return the result of password validation.