Class PasswordReset
This class offers some features to implement a password reset flow.
Namespace: CRUDlex
Located at PasswordReset.php
Methods summary
protected
null|CRUDlex\Entity
|
#
getValidPasswordReset( string $token )
Gets the password reset of a token but only if it is younger than 48h.
Gets the password reset of a token but only if it is younger than 48h.
Parameters
- $token
- the password reset token
Returns
null|CRUDlex\Entity the password reset request
|
public
|
#
__construct( CRUDlex\Data $userData, CRUDlex\Data $passwordResetData )
Constructor.
Parameters
- $userData
- the user data instance
- $passwordResetData
- the password reset data instance
|
public
null|string
|
#
requestPasswordReset( string $identifyingField, string $identifyingValue )
Creates a password reset request.
Creates a password reset request.
Parameters
- $identifyingField
- the identifying field to grab an user, likely the email
- $identifyingValue
- the identifying value to grab an user, likely the email
Returns
null|string the token of the password reset instance ready to be send to the user via
a secondary channel like email; might be null if the user could not be
identified uniquly via the given parameters: either zero or more than one
users were found
|
public
boolean
|
#
resetPassword( string $token, string $newPassword )
Resets the password of an user belonging to the given password reset
token.
Resets the password of an user belonging to the given password reset
token.
Parameters
- $token
- the password reset token
- $newPassword
- the new password
Returns
boolean true on success, false on failure with one of this reasons:
- no or more than one password reset request found for this token
- the password request for this token is older than 48h
- the password request for this token has already been used
|
Properties summary
protected
|
$userData
Holds the user Data instance.
Holds the user Data instance.
|
|
protected
|
$passwordResetData
Holds the password reset Data instance.
Holds the password reset Data instance.
|
|