From 032bef40125791cc9c849bb533d7989acf61ece1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Sep 2004 13:16:01 +0000 Subject: [PATCH] fix for bug [ 1022807 ] users with some login names can't login --- phpgwapi/inc/class.sessions.inc.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/phpgwapi/inc/class.sessions.inc.php b/phpgwapi/inc/class.sessions.inc.php index 24707712fb..2f06aea02f 100644 --- a/phpgwapi/inc/class.sessions.inc.php +++ b/phpgwapi/inc/class.sessions.inc.php @@ -471,11 +471,13 @@ //echo "

session::create(login='$login'): lid='$this->account_lid', domain='$this->account_domain'

\n"; $user_ip = $this->getuser_ip(); + + $this->account_id = $GLOBALS['phpgw']->accounts->name2id($this->account_lid); if (($blocked = $this->login_blocked($login,$user_ip)) || // too many unsuccessful attempts $GLOBALS['phpgw_info']['server']['global_denied_users'][$this->account_lid] || !$GLOBALS['phpgw']->auth->authenticate($this->account_lid, $this->passwd, $this->passwd_type) || - $GLOBALS['phpgw']->accounts->get_type($this->account_lid) == 'g') + $this->account_id && $GLOBALS['phpgw']->accounts->get_type($this->account_id) == 'g') { $this->reason = $blocked ? 'blocked, too many attempts' : 'bad login or password'; $this->cd_reason = $blocked ? 99 : 5; @@ -484,14 +486,11 @@ return False; } - if ((!$GLOBALS['phpgw']->accounts->exists($this->account_lid)) && $GLOBALS['phpgw_info']['server']['auto_create_acct'] == True) + if (!$this->account_id && $GLOBALS['phpgw_info']['server']['auto_create_acct'] == True) { $this->account_id = $GLOBALS['phpgw']->accounts->auto_add($this->account_lid, $passwd); } - else - { - $this->account_id = $GLOBALS['phpgw']->accounts->name2id($this->account_lid); - } + $GLOBALS['phpgw_info']['user']['account_id'] = $this->account_id; $GLOBALS['phpgw']->accounts->accounts($this->account_id); $this->sessionid = $this->new_session_id();