fix to allow @ in usernames if no (only one) eGW-domain is used

This commit is contained in:
Ralf Becker 2003-11-13 23:15:55 +00:00
parent 392703e0e1
commit 0d250b0c82
3 changed files with 25 additions and 5 deletions

View File

@ -160,6 +160,10 @@
{
$login .= '@' . $_POST['logindomain'];
}
elseif(count($GLOBALS['phpgw_domain']) == 1)
{
$login .= '@'.$GLOBALS['phpgw_info']['server']['default_domain'];
}
$GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create($login,$_POST['passwd'],$_POST['passwd_type']);
if (! isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid'])

View File

@ -244,6 +244,13 @@
}
}
function split_login_domain($both,&$login,&$domain)
{
$parts = explode('@',$both);
$domain = array_pop($parts);
$login = implode('@',$parts);
}
/**
* Check to see if a session is still current and valid
*
@ -277,7 +284,7 @@
$this->session_flags = $session['session_flags'];
list($this->account_lid,$this->account_domain) = explode('@', $session['session_lid']);
$this->split_login_domain($session['session_lid'],$this->account_lid,$this->account_domain);
if ($this->account_domain == '')
{
@ -496,7 +503,8 @@
}
$this->clean_sessions();
list($this->account_lid,$this->account_domain) = explode('@', $login);
$this->split_login_domain($login,$this->account_lid,$this->account_domain);
$now = time();
if (strstr($login,'@') === False)

View File

@ -91,11 +91,12 @@
if (isset($_POST['login'])) // on login
{
$GLOBALS['login'] = $_POST['login'];
if (strstr($GLOBALS['login'],'@') === False)
if (strstr($GLOBALS['login'],'@') === False || count($GLOBALS['phpgw_domain']) == 1)
{
$GLOBALS['login'] .= '@' . get_var('logindomain',array('POST'),$GLOBALS['phpgw_info']['server']['default_domain']);
}
list(,$GLOBALS['phpgw_info']['user']['domain']) = explode('@',$GLOBALS['login']);
$parts = explode('@',$GLOBALS['login']);
$GLOBALS['phpgw_info']['user']['domain'] = array_pop($parts);
}
else // on "normal" pageview
{
@ -258,7 +259,14 @@
{
if (@$_POST['login'] != '')
{
list($login) = explode("@",$_POST['login']);
if (count($GLOBALS['phpgw_domain']) > 1)
{
list($login) = explode('@',$_POST['login']);
}
else
{
$login = $_POST['login'];
}
print_debug('LID',$login,'app');
$login_id = $GLOBALS['phpgw']->accounts->name2id($login);
print_debug('User ID',$login_id,'app');