fixed auth_sql to allow updating passwords of in-active accounts and return true for all successfull password changes as documented (returned false if password was unchanged and hash password on success)

This commit is contained in:
Ralf Becker 2013-06-26 09:49:57 +00:00
parent eadc4edf2e
commit 76abb48fa4
2 changed files with 7 additions and 7 deletions

View File

@ -61,7 +61,7 @@ class auth_fallback implements auth_backend
$GLOBALS['egw_info']['flags']['currentapp'] = 'admin'; // otherwise
$ret = $this->fallback_backend->change_password('', $passwd, $account_id);
$GLOBALS['egw_info']['flags']['currentapp'] = $backup_currentapp;
error_log(__METHOD__."('$username', \$passwd) updated password for #$account_id on fallback ".($ret ? 'successfull' : 'failed!'));
//error_log(__METHOD__."('$username', \$passwd) updated password for #$account_id on fallback ".($ret ? 'successfull' : 'failed!'));
}
return true;
}

View File

@ -214,7 +214,6 @@ class auth_sql implements auth_backend
if (($pw = $this->db->select($this->table,'account_pwd',array(
'account_id' => $account_id,
'account_type' => 'u',
'account_status' => 'A',
),__LINE__,__FILE__)->fetchColumn()) === false)
{
return false; // account not found
@ -244,16 +243,17 @@ class auth_sql implements auth_backend
$update = array('account_pwd' => $encrypted_passwd);
if ($update_lastpw_change) $update['account_lastpwd_change'] = time();
$this->db->update($this->table,$update,array(
if (!$this->db->update($this->table,$update,array(
'account_id' => $account_id,
),__LINE__,__FILE__);
if(!$this->db->affected_rows()) return false;
),__LINE__,__FILE__))
{
return false;
}
if(!$admin)
{
egw_cache::setSession('phpgwapi','auth_alpwchange_val',$update['account_lastpwd_change']);
}
return $encrypted_passwd;
return true;
}
}