Wt  4.11.1
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. More...
 
virtual Result validate (const WString &password, const WString &loginName, const std::string &email) const
 Validates a password. More...
 
virtual Result validate (const WString &password) const override
 Validates a password. More...
 
- Public Member Functions inherited from Wt::WValidator
 WValidator (bool mandatory=false)
 Creates a new validator. More...
 
virtual ~WValidator ()
 Destructor. More...
 
void setMandatory (bool how)
 Sets if input is mandatory. More...
 
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. More...
 
WString invalidBlankText () const
 Returns the message displayed when a mandatory field is left blank. More...
 
virtual WString format () const
 Returns the validator format. More...
 
virtual std::string javaScriptValidate () const
 Creates a Javascript object that validates the input. More...
 
virtual std::string inputFilter () const
 Returns a regular expression that filters input. More...
 

Additional Inherited Members

- Public Types inherited from Wt::WValidator
typedef ValidationState State
 Typedef for enum Wt::ValidationState.
 

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]

WValidator::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]

WValidator::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.