+} elseif (isGetRequestElementSet('reset_pass')) {
+ // Is the form submitted?
+ if ((isPostRequestElementSet('send_link')) && (isPostRequestElementSet('email'))) {
+ // Output result
+ loadTemplate('admin_settings_saved', false, sendAdminPasswordResetLink(postRequestElement('email')));
+ } elseif (isGetRequestElementSet('hash')) {
+ // Output form for hash validation
+ loadTemplate('admin_validate_reset_hash_form', false, getRequestElement('hash'));
+ } elseif ((isPostRequestElementSet('validate_hash')) && (isPostRequestElementSet('login')) && (isPostRequestElementSet('hash'))) {
+ // Validate the login data and hash
+ $valid = adminResetValidateHashLogin(postRequestElement('hash'), postRequestElement('login'));
+
+ // Valid?
+ if ($valid === true) {
+ // Prepare content first
+ $content = array(
+ 'hash' => SQL_ESCAPE(postRequestElement('hash')),
+ 'login' => SQL_ESCAPE(postRequestElement('login'))
+ );
+
+ // Validation okay so display form for final password change
+ loadTemplate('admin_reset_password_form', false, $content);
+ } else {
+ // Cannot validate the login data and hash
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_VALIDATION_RESET_LOGIN_HASH_FAILED'));
+ }
+ } elseif ((isPostRequestElementSet('reset_pass')) && (isPostRequestElementSet('hash')) && (isPostRequestElementSet('login')) && (isPostRequestElementSet('pass1')) && (postRequestElement('pass1') == postRequestElement('pass2'))) {
+ // Okay, we shall the admin password here. So first revalidate the hash
+ if (adminResetValidateHashLogin(postRequestElement('hash'), postRequestElement('login'))) {
+ // Output result
+ loadTemplate('admin_reset_pass_done', false, doResetAdminPassword(postRequestElement('login'), postRequestElement('pass1')));
+ } else {
+ // Validation failed
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_VALIDATION_RESET_LOGIN_HASH_FAILED2'));
+ }
+ } else {
+ // Output reset password form
+ loadTemplate('admin_send_reset_link');
+ }
+} elseif ((!isSessionVariableSet('admin_login')) || (!isSessionVariableSet('admin_md5')) || (!isSessionVariableSet('admin_last')) || (!isSessionVariableSet('admin_to')) || ((getSession('admin_last') + bigintval(getSession('admin_to')) * 3600 * 24) < time())) {