X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fsession.inc;h=1b9c5ce2daa48631079f207014ee2882f22f8cb3;hb=aa7eb75a2b21809008113779e9b6c5fa7a869c9b;hp=869ce9a805820d5ee5ccb4145b72e07ebf850f00;hpb=a5dcd87f46080a624b1a9ad4b0dd035bbd24ac50;p=fa-stable.git diff --git a/includes/session.inc b/includes/session.inc index 869ce9a8..1b9c5ce2 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -144,6 +144,35 @@ function login_fail() die(); } +function password_reset_fail() +{ + global $path_to_root; + + echo "


" . _("Incorrect Email") . "

"; + echo "" . _("The email address does not exist in the system.") . "

"; + + echo _("If you are not an authorized user, please contact your system administrator to obtain an account to enable you to use the system."); + echo "
" . _("Try again") . ""; + echo "
"; + + kill_login(); + die(); +} + +function password_reset_success() +{ + global $path_to_root; + + echo "


" . _("New password sent") . "

"; + echo "" . _("A new password has been sent to your mailbox.") . "

"; + + echo "
" . _("Login here") . ""; + echo "
"; + + kill_login(); + die(); +} + function check_faillog() { global $login_delay, $login_faillog, $login_max_attempts; @@ -423,6 +452,33 @@ if (!defined('FA_LOGOUT_PHP_FILE')){ if (!$_SESSION["wa_current_user"]->logged_in()) { + if (@$allow_password_reset && !$allow_demo_mode + && (isset($_GET['reset']) || isset($_POST['email_entry_field']))) { + if (!isset($_POST["email_entry_field"])) { + include($path_to_root . "/access/password_reset.php"); + exit(); + } + else { + if (isset($_POST["company_login_nickname"]) && !isset($_POST["company_login_name"])) { + for ($i = 0; $i < count($db_connections); $i++) { + if ($db_connections[$i]["name"] == $_POST["company_login_nickname"]) { + $_POST["company_login_name"] = $i; + unset($_POST["company_login_nickname"]); + break 1; // cannot pass variables to break from PHP v5.4 onwards + } + } + } + $_succeed = isset($db_connections[$_POST["company_login_name"]]) && + $_SESSION["wa_current_user"]->reset_password($_POST["company_login_name"], + $_POST["email_entry_field"]); + if ($_succeed) + { + password_reset_success(); + } + + password_reset_fail(); + } + } // Show login screen if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "") {