getPasswordRecoveryCode($tUsername); if ($token !== false) { $table = table_by_key($context === 'users' ? 'mailbox' : 'admin'); $row = db_query_one("SELECT * FROM $table WHERE username= :username", array('username' => $username)); // $row must exist unless there's a race condition? $email_other = isset($row['email_other']) ? trim($row['email_other']) : null; $phone = isset($row['phone']) ? trim($row['phone']) : null; if ($email_other) { sendCodeByEmail($email_other, $tUsername, $token); } elseif ($phone) { sendCodeBySMS($phone, $tUsername, $token); } else { error_log(__FILE__ . " - No mechanism configured for password-recovery."); } if ($email_other || $phone) { header("Location: password-change.php?username=" . $tUsername); exit(0); } } // throttle password reset requests to prevent brute force attack $elapsed_time = microtime(true) - $start_time; if ($elapsed_time < 2 * pow(10, 6)) { usleep(2 * pow(10, 6) - $elapsed_time); } flash_info(Config::Lang('pPassword_recovery_processed')); } $smarty->assign('language_selector', language_selector(), false); $smarty->assign('smarty_template', 'password-recover'); $smarty->display('index.tpl'); /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */