You are here

function _recovery_pass_store_old_pass in Recovery Password (Email New Password) 7

Same name and namespace in other branches
  1. 8 recovery_pass.module \_recovery_pass_store_old_pass()

Temporarily stores old password in custom table for error message in future.

2 calls to _recovery_pass_store_old_pass()
recovery_pass_forgot_password_submit in ./recovery_pass.module
Custom submit handler to send password in recovery mail.
_recovery_pass_request_new_password in ./recovery_pass.resource.inc

File

./recovery_pass.module, line 103
Alters default Drupal password recovery process by overriding default submit.

Code

function _recovery_pass_store_old_pass($user) {

  // Update or Insert using db_merge() the old password.
  $result = db_merge('recovery_pass')
    ->key(array(
    'uid' => $user->uid,
  ))
    ->fields(array(
    'uid' => (int) $user->uid,
    'old_pass' => $user->pass,
    'changed' => time(),
  ))
    ->execute();
  if ($result) {

    // Successfully saved old password.
    return TRUE;
  }
  return FALSE;
}