PHP Класс PasswordResetModel, huge

Handles all the stuff that is related to the password-reset process
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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)

Описание методов

changePassword() публичный статический Метод

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
Результат boolean

requestPasswordReset() публичный статический Метод

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
Результат boolean success status

saveChangedPassword() публичный статический Метод

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
Результат boolean

saveNewUserPassword() публичный статический Метод

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
Результат boolean

sendPasswordResetMail() публичный статический Метод

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
Результат boolean success status

setNewPassword() публичный статический Метод

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
Результат boolean success state of the password reset

setPasswordResetDatabaseToken() публичный статический Метод

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
Результат boolean success status

validatePasswordChange() публичный статический Метод

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
Результат boolean

validateResetPassword() публичный статический Метод

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
Результат boolean

verifyPasswordReset() публичный статический Метод

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
Результат boolean Success status