diff --git a/login.php b/login.php index 373720b65d..235b1add6c 100755 --- a/login.php +++ b/login.php @@ -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']) diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index 0dfd5de406..acf17f8c97 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -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) diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index c22e188180..64bd0e013a 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -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');