document.forms[0].company_login_name.options[".user_company()."].selected = true;
}
</script>";
+
add_js_file('login.js');
// Display demo user name and password within login form if allow_demo_mode option is true
if ($SysPrefs->allow_demo_mode == true)
{
echo $js;
}
+
echo "</head>\n";
echo "<body id='loginscreen' $onload>\n";
}
echo "</td>\n";
end_row();
-
if (!$login_timeout)
table_section_title(_("Version")." $version Build ".$SysPrefs->build_version." - "._("Login"));
$value = $login_timeout ? $_SESSION['wa_current_user']->loginname : ($SysPrefs->allow_demo_mode ? "demouser":"");
} else {
text_row(_("Company"), "company_login_nickname", "", 20, 50);
}
- start_row();
- label_cell($demo_text, "colspan=2 align='center' id='log_msg'");
- end_row();
};
+ start_row();
+ label_cell($demo_text, "colspan=2 align='center' id='log_msg'");
+ end_row();
end_table(1);
echo "<input type='hidden' id=ui_mode name='ui_mode' value='".!fallback_mode()."' >\n";
echo "<center><input type='submit' value=' "._("Login -->")." ' name='SubmitUser'"
- ." onclick='set_fullmode();'".(isset($blocked_msg) ? " disabled" : '')." ></center>\n";
+ ." onclick='".(in_ajax() ? 'retry();': 'set_fullmode();')."'".(isset($blocked_msg) ? " disabled" : '')." ></center>\n";
foreach($_SESSION['timeout']['post'] as $p => $val) {
// add all request variables to be resend together with login data
echo "<input type='hidden' name='{$p}[$i]' value='$v'>";
}
end_form(1);
- $Ajax->addScript(true, "document.forms[0].password.focus();");
+ $Ajax->addScript(true, "if (document.forms.length) document.forms[0].password.focus();");
echo "<script language='JavaScript' type='text/javascript'>
//<![CDATA[
function login_fail()
{
global $path_to_root;
-
+
header("HTTP/1.1 401 Authorization Required");
echo "<center><br><br><font size='5' color='red'><b>" . _("Incorrect Password") . "<b></font><br><br>";
echo "<b>" . _("The user and password combination is not valid for the system.") . "<b><br><br>";
-
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 "<br><a href='$path_to_root/index.php'>" . _("Try again") . "</a>";
echo "</center>";
-
kill_login();
die();
}
'', html_specials_encode($_SERVER['REQUEST_URI'])),
'post' => $_POST);
+ if (in_ajax())
+ $Ajax->popup($path_to_root ."/access/timeout.php");
+ else
include($path_to_root . "/access/login.php");
- if (in_ajax())
- $Ajax->activate('_page_body');
exit;
} else {
if (isset($_POST["company_login_nickname"]) && !isset($_POST["company_login_name"])) {
if (!$succeed)
{
// Incorrect password
- login_fail();
+ if (isset($_SESSION['timeout'])) {
+ include($path_to_root . "/access/login.php");
+ exit;
+ } else
+ login_fail();
}
elseif(isset($_SESSION['timeout']) && !$_SESSION['timeout']['post'])
{
ev.returnValue = false;
return false;
}
- if (editors!=='undefined' && editors[key]) {
+ if (editors!==undefined && editors[key]) {
callEditor(key);
return stopEv(ev); // prevent default binding
}
document.loginform.submit();
return true;
}
+
+function retry() {
+ document.getElementById('ui_mode').value = 1;
+ JsHttpRequest.request(this);
+ return true;
+}
return false;
}
},
- 'button': function(e) {
- e.onclick = function() {
- window.open('', 'formpopup', 'toolbar=no,scrollbars=yes,resizable=yes,menubar=no');
- e.form.target='formpopup';
- }
- },
}
function set_options(e)