log if no mechanisms were used for password recovery

pull/248/head
David Goodwin 6 years ago
parent db4aecd23c
commit ed99a46ec4

@ -68,6 +68,7 @@ if ($_SERVER['REQUEST_METHOD'] === "POST") {
$handler = $context === 'admin' ? new AdminHandler : new MailboxHandler; $handler = $context === 'admin' ? new AdminHandler : new MailboxHandler;
$token = $handler->getPasswordRecoveryCode($tUsername); $token = $handler->getPasswordRecoveryCode($tUsername);
if ($token !== false) { if ($token !== false) {
$table = table_by_key($context === 'users' ? 'mailbox' : 'admin'); $table = table_by_key($context === 'users' ? 'mailbox' : 'admin');
$row = db_query_one("SELECT * FROM $table WHERE username= :username", array('username' => $username)); $row = db_query_one("SELECT * FROM $table WHERE username= :username", array('username' => $username));
@ -79,10 +80,12 @@ if ($_SERVER['REQUEST_METHOD'] === "POST") {
if ($email_other) { if ($email_other) {
sendCodeByEmail($email_other, $tUsername, $token); sendCodeByEmail($email_other, $tUsername, $token);
} }
elseif ($phone) {
if ($phone) {
sendCodeBySMS($phone, $tUsername, $token); sendCodeBySMS($phone, $tUsername, $token);
} }
else {
error_log(__FILE__ . " - No mechanism configured for password-recovery.");
}
if ($email_other || $phone) { if ($email_other || $phone) {
header("Location: password-change.php?username=" . $tUsername); header("Location: password-change.php?username=" . $tUsername);

Loading…
Cancel
Save