PHP Class PasswordResetModel, huge

Handles all the stuff that is related to the password-reset process
Mostrar archivo Open project: panique/huge Class Usage Examples

Public Methods

Method Description
changePassword ( string $user_name, string $user_password_current, string $user_password_new, string $user_password_repeat ) : boolean Validates fields, hashes new password, saves new password
requestPasswordReset ( $user_name_or_email, $captcha ) : boolean Perform the necessary actions to send a password reset mail
saveChangedPassword ( string $user_name, string $user_password_hash ) : boolean Writes the new password to the database
saveNewUserPassword ( string $user_name, string $user_password_hash, string $user_password_reset_hash ) : boolean Writes the new password to the database
sendPasswordResetMail ( string $user_name, string $user_password_reset_hash, string $user_email ) : boolean Send the password reset mail
setNewPassword ( string $user_name, string $user_password_reset_hash, string $user_password_new, string $user_password_repeat ) : boolean Set the new password (for DEFAULT user, FACEBOOK-users don't have a password) Please note: At this point the user has already pre-verified via verifyPasswordReset() (within one hour), so we don't need to check again for the 60min-limit here. In this method we authenticate via username & password-reset-hash from (hidden) form fields.
setPasswordResetDatabaseToken ( string $user_name, string $user_password_reset_hash, integer $temporary_timestamp ) : boolean Set password reset token in database (for DEFAULT user accounts)
validatePasswordChange ( string $user_name, string $user_password_current, string $user_password_new, string $user_password_repeat ) : boolean Validates current and new passwords
validateResetPassword ( $user_name, $user_password_reset_hash, $user_password_new, $user_password_repeat ) : boolean Validate the password submission
verifyPasswordReset ( string $user_name, string $verification_code ) : boolean Verifies the password reset request via the verification hash token (that's only valid for one hour)

Method Details

changePassword() public static method

Validates fields, hashes new password, saves new password
public static changePassword ( string $user_name, string $user_password_current, string $user_password_new, string $user_password_repeat ) : boolean
$user_name string
$user_password_current string
$user_password_new string
$user_password_repeat string
return boolean

requestPasswordReset() public static method

Perform the necessary actions to send a password reset mail
public static requestPasswordReset ( $user_name_or_email, $captcha ) : boolean
$user_name_or_email string Username or user's email
$captcha string Captcha string
return boolean success status

saveChangedPassword() public static method

Writes the new password to the database
public static saveChangedPassword ( string $user_name, string $user_password_hash ) : boolean
$user_name string
$user_password_hash string
return boolean

saveNewUserPassword() public static method

Writes the new password to the database
public static saveNewUserPassword ( string $user_name, string $user_password_hash, string $user_password_reset_hash ) : boolean
$user_name string username
$user_password_hash string
$user_password_reset_hash string
return boolean

sendPasswordResetMail() public static method

Send the password reset mail
public static sendPasswordResetMail ( string $user_name, string $user_password_reset_hash, string $user_email ) : boolean
$user_name string username
$user_password_reset_hash string password reset hash
$user_email string user email
return boolean success status

setNewPassword() public static method

Set the new password (for DEFAULT user, FACEBOOK-users don't have a password) Please note: At this point the user has already pre-verified via verifyPasswordReset() (within one hour), so we don't need to check again for the 60min-limit here. In this method we authenticate via username & password-reset-hash from (hidden) form fields.
public static setNewPassword ( string $user_name, string $user_password_reset_hash, string $user_password_new, string $user_password_repeat ) : boolean
$user_name string
$user_password_reset_hash string
$user_password_new string
$user_password_repeat string
return boolean success state of the password reset

setPasswordResetDatabaseToken() public static method

Set password reset token in database (for DEFAULT user accounts)
public static setPasswordResetDatabaseToken ( string $user_name, string $user_password_reset_hash, integer $temporary_timestamp ) : boolean
$user_name string username
$user_password_reset_hash string password reset hash
$temporary_timestamp integer timestamp
return boolean success status

validatePasswordChange() public static method

Validates current and new passwords
public static validatePasswordChange ( string $user_name, string $user_password_current, string $user_password_new, string $user_password_repeat ) : boolean
$user_name string
$user_password_current string
$user_password_new string
$user_password_repeat string
return boolean

validateResetPassword() public static method

Validate the password submission
public static validateResetPassword ( $user_name, $user_password_reset_hash, $user_password_new, $user_password_repeat ) : boolean
$user_name
$user_password_reset_hash
$user_password_new
$user_password_repeat
return boolean

verifyPasswordReset() public static method

Verifies the password reset request via the verification hash token (that's only valid for one hour)
public static verifyPasswordReset ( string $user_name, string $verification_code ) : boolean
$user_name string Username
$verification_code string Hash token
return boolean Success status