mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
move check_logoutcode to Api\Framework\Login, where it is used
This commit is contained in:
parent
0136ed2112
commit
fa148e4c89
@ -67,7 +67,7 @@ class Login
|
|||||||
$tmpl->set_block('login_form','change_password');
|
$tmpl->set_block('login_form','change_password');
|
||||||
$tmpl->set_var('change_password', '');
|
$tmpl->set_var('change_password', '');
|
||||||
$tmpl->set_var('lang_password',lang('password'));
|
$tmpl->set_var('lang_password',lang('password'));
|
||||||
$tmpl->set_var('cd',check_logoutcode($_GET['cd']));
|
$tmpl->set_var('cd', self::check_logoutcode($_GET['cd']));
|
||||||
$tmpl->set_var('cd_class', isset($_GET['cd']) && $_GET['cd'] != 1 ? 'error' : '');
|
$tmpl->set_var('cd_class', isset($_GET['cd']) && $_GET['cd'] != 1 ? 'error' : '');
|
||||||
$last_loginid = $_COOKIE['last_loginid'];
|
$last_loginid = $_COOKIE['last_loginid'];
|
||||||
$last_domain = $_COOKIE['last_domain'];
|
$last_domain = $_COOKIE['last_domain'];
|
||||||
@ -251,4 +251,42 @@ class Login
|
|||||||
|
|
||||||
$this->framework->render($tmpl->fp('loginout','login_form'),false,false);
|
$this->framework->render($tmpl->fp('loginout','login_form'),false,false);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Return verbose message for nummeric logout code ($_GET[cd])
|
||||||
|
*
|
||||||
|
* @param int|string $code
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static function check_logoutcode($code)
|
||||||
|
{
|
||||||
|
switch($code)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return lang('You have been successfully logged out');
|
||||||
|
case 2:
|
||||||
|
return lang('Sorry, your login has expired');
|
||||||
|
case 4:
|
||||||
|
return lang('Cookies are required to login to this site');
|
||||||
|
case Api\Session::CD_BAD_LOGIN_OR_PASSWORD:
|
||||||
|
return lang('Bad login or password');
|
||||||
|
case Api\Session::CD_FORCE_PASSWORD_CHANGE:
|
||||||
|
return lang('You must change your password!');
|
||||||
|
case Api\Session::CD_ACCOUNT_EXPIRED:
|
||||||
|
return lang('Account is expired');
|
||||||
|
case Api\Session::CD_BLOCKED:
|
||||||
|
return lang('Blocked, too many attempts');
|
||||||
|
case 10:
|
||||||
|
$GLOBALS['egw']->session->egw_setcookie('sessionid');
|
||||||
|
$GLOBALS['egw']->session->egw_setcookie('kp3');
|
||||||
|
$GLOBALS['egw']->session->egw_setcookie('domain');
|
||||||
|
return lang('Your session timed out, please log in again');
|
||||||
|
default:
|
||||||
|
if (!$code)
|
||||||
|
{
|
||||||
|
return ' ';
|
||||||
|
}
|
||||||
|
return htmlspecialchars($code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
32
login.php
32
login.php
@ -131,38 +131,6 @@ else
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_logoutcode($code)
|
|
||||||
{
|
|
||||||
switch($code)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
return lang('You have been successfully logged out');
|
|
||||||
case 2:
|
|
||||||
return lang('Sorry, your login has expired');
|
|
||||||
case 4:
|
|
||||||
return lang('Cookies are required to login to this site');
|
|
||||||
case Api\Session::CD_BAD_LOGIN_OR_PASSWORD:
|
|
||||||
return lang('Bad login or password');
|
|
||||||
case Api\Session::CD_FORCE_PASSWORD_CHANGE:
|
|
||||||
return lang('You must change your password!');
|
|
||||||
case Api\Session::CD_ACCOUNT_EXPIRED:
|
|
||||||
return lang('Account is expired');
|
|
||||||
case Api\Session::CD_BLOCKED:
|
|
||||||
return lang('Blocked, too many attempts');
|
|
||||||
case 10:
|
|
||||||
$GLOBALS['egw']->session->egw_setcookie('sessionid');
|
|
||||||
$GLOBALS['egw']->session->egw_setcookie('kp3');
|
|
||||||
$GLOBALS['egw']->session->egw_setcookie('domain');
|
|
||||||
return lang('Your session timed out, please log in again');
|
|
||||||
default:
|
|
||||||
if (!$code)
|
|
||||||
{
|
|
||||||
return ' ';
|
|
||||||
}
|
|
||||||
return htmlspecialchars($code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Program starts here */
|
/* Program starts here */
|
||||||
|
|
||||||
// some apache mod_auth_* modules use REMOTE_USER instead of PHP_AUTH_USER, thanks to Sylvain Beucler
|
// some apache mod_auth_* modules use REMOTE_USER instead of PHP_AUTH_USER, thanks to Sylvain Beucler
|
||||||
|
Loading…
Reference in New Issue
Block a user