Finished portal password recovery.

pull/136/head
Joe Prochazka 2016-04-01 15:22:47 -04:00
rodzic 8b65c57ea2
commit bc18b44c33
2 zmienionych plików z 11 dodań i 6 usunięć

Wyświetl plik

@ -59,11 +59,13 @@
// Create and send the email.
$subject = $common->getSetting("siteName")." Password Reset Request";
$message = "A password reset request has been received by your ADS-B portal./r/n";
$message .= "If you did not request this password reset simply disregard this email./r/n";
$message .= "If in fact you did request a password reset follow the link below to do so./r/n";
$message .= "/r/n";
$message .= "http://".$_SERVER['HTTP_HOST']."/admin/reset.php?token=".$token."/r/n";
$message = "A password reset request has been received by your ADS-B portal.\r\n";
$message .= "\r\n";
$message .= "If you did not request this password reset simply disregard this email.\r\n";
$message .= "If in fact you did request a password reset follow the link below to do so.\r\n";
$message .= "\r\n";
$message .= "http://".$_SERVER['HTTP_HOST']."/admin/reset.php?token=".$token."\r\n";
$message .= "\r\n";
$message .= "Your password reset token is: ".$token;
$emailSent = $common->sendEmail($account->getEmail($_POST['login']), $subject, $message);

Wyświetl plik

@ -32,9 +32,11 @@
// Load the require PHP classes.
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."common.class.php");
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."settings.class.php");
require_once($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR."account.class.php");
$common = new common();
$settings = new settings();
$account = new account();
// Check if the user is already logged in.
@ -68,8 +70,9 @@
$notMatching = FALSE;
// If everything associated with passwords is validated change the password.
if (!$tooShort && !$notMatching && $authenticated) {
if (!$tooShort && !$notMatching) {
// Change the password stored in administrators.xml related to this users login.
$account->setToken($login);
$account->changePassword($login, password_hash($_POST['password1'], PASSWORD_DEFAULT));
header ("Location: login.php");
}