- use UI:exitError() for error messages

- redirect to next page
This commit is contained in:
steinm 2013-01-29 13:11:39 +00:00
parent 57e29071d8
commit de855452cf
2 changed files with 17 additions and 14 deletions

View File

@ -48,17 +48,18 @@ if (isset($_POST["newpasswordrepeat"])) {
}
if (empty($newpassword) || empty($newpasswordrepeat) || $newpassword != $newpasswordrepeat) {
_printMessage(getMLText("password_mismatch_error_title"), "<p>".getMLText("password_mismatch_error")."</p>\n");
exit;
UI::exitError(getMLText("password_mismatch_error_title"),getMLText("password_mismatch_error"));
}
$user = $dms->checkPasswordRequest($hash);
if($user) {
$user->setPwd(md5($newpassword));
$dms->deletePasswordRequest($hash);
header('Location: ../out/out.Login.php');
exit;
}
_printMessage(getMLText("change_password"), "<p>".getMLText("change_password_message")."</p>");
exit;
UI::exitError(getMLText("password_mismatch_error_title"),getMLText("password_mismatch_error"));
?>

View File

@ -19,7 +19,7 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php");
include("../inc/inc.LogInit.php");
include("../inc/inc.LogInit.php");
include("../inc/inc.Utils.php");
include("../inc/inc.Language.php");
include("../inc/inc.ClassSession.php");
@ -27,6 +27,8 @@ include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.ClassEmail.php");
include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc";
function _printMessage($heading, $message) {
UI::htmlStartPage($heading, "password");
@ -45,21 +47,21 @@ if (isset($_POST["login"])) {
}
if (empty($email) || empty($login)) {
_printMessage(getMLText("email_error_title"), "<p>".getMLText("email_not_given")."</p>\n".
"<p><a href='".$settings->_httpRoot."out/out.PasswordForgotten.php'>".getMLText("back")."</a></p>\n");
header('Location: ../out/out.PasswordForgotten.php');
exit;
}
$user = $dms->getUserByLogin($login, $email);
if($user) {
$hash = $dms->createPasswordRequest($user);
$emailobj = new LetoDMS_Email();
$subject = "###SITENAME###: ".getMLText("password_forgotten_email_subject");
$message = str_replace('###HASH###', $hash, getMLText("password_forgotten_email_body"));
$emailobj->sendPassword('', $user, $subject, $message);
if($hash = $dms->createPasswordRequest($user)) {
$emailobj = new LetoDMS_Email();
$subject = "###SITENAME###: ".getMLText("password_forgotten_email_subject");
$message = str_replace('###HASH###', $hash, getMLText("password_forgotten_email_body"));
$emailobj->sendPassword('', $user, $subject, $message);
}
}
_printMessage(getMLText("password_forgotten_title"), "<p>".getMLText("password_forgotten_send_hash")."</p>");
header('Location: ../out/out.Login.php');
exit;
?>