function _recovery_pass_store_old_pass in Recovery Password (Email New Password) 8
Same name and namespace in other branches
- 7 recovery_pass.module \_recovery_pass_store_old_pass()
Temporarily stores old password in custom table for error message in future.
1 call to _recovery_pass_store_old_pass()
- recovery_pass_forgot_password_submit in ./
recovery_pass.module - Custom submit handler to send password in recovery mail.
File
- ./
recovery_pass.module, line 133 - Contains module code.
Code
function _recovery_pass_store_old_pass($user) {
// Update or Insert using merge() the old password.
$result = \Drupal::database()
->merge('recovery_pass');
$result
->key(array(
'uid' => (int) $user
->get('uid')->value,
))
->fields(array(
'uid' => (int) $user
->get('uid')->value,
'old_pass' => $user
->get('pass')->value,
'changed' => time(),
))
->execute();
if ($result) {
// Successfully saved old password.
return TRUE;
}
return FALSE;
}