mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 18:03:39 +01:00
moved change_password code to the auth class where it belongs
This commit is contained in:
parent
9b7dfe7315
commit
534337b237
@ -23,5 +23,9 @@
|
||||
return False;
|
||||
}
|
||||
}
|
||||
function change_password($old_passwd, $new_passwd) {
|
||||
global $phpgw_info, $phpgw;
|
||||
return $old_passwd;
|
||||
}
|
||||
}
|
||||
?>
|
@ -43,5 +43,23 @@
|
||||
// dn not found or password wrong
|
||||
return False;
|
||||
}
|
||||
|
||||
function change_password($old_passwd, $new_passwd) {
|
||||
global $phpgw_info, $phpgw;
|
||||
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
|
||||
|
||||
if (! @ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) {
|
||||
echo "<p><b>Error binding to LDAP server. Check your config</b>";
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$encrypted_passwd = $phpgw->common->encrypt_password($new_passwd);
|
||||
$entry["userpassword"] = $encrypted_passwd
|
||||
$entry["phpgw_lastpasswd_change"] = time();
|
||||
|
||||
$dn = $phpgw_info["user"]["account_dn"];
|
||||
@ldap_modify($ldap, $dn, $entry);
|
||||
return $encrypted_passwd;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -39,5 +39,9 @@
|
||||
return True;
|
||||
}
|
||||
}
|
||||
function change_password($old_passwd, $new_passwd) {
|
||||
global $phpgw_info, $phpgw;
|
||||
return $old_passwd;
|
||||
}
|
||||
}
|
||||
?>
|
@ -35,5 +35,16 @@
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
function change_password($old_passwd, $new_passwd) {
|
||||
global $phpgw_info, $phpgw;
|
||||
$encrypted_passwd = md5($new_passwd);
|
||||
$phpgw->db->query("update accounts set account_pwd='" . md5($new_passwd) . "' "
|
||||
. "where account_lid='" . $phpgw_info["user"]["userid"] . "'",__LINE__,__FILE__);
|
||||
$phpgw->db->query("update accounts set account_lastpwd_change='" . time() . "' where account_id='"
|
||||
. $phpgw_info["user"]["account_id"] . "'",__LINE__,__FILE__);
|
||||
|
||||
return $encrypted_passwd;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -73,31 +73,9 @@
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
if ($phpgw_info["server"]["auth_type"] == "sql") {
|
||||
$phpgw->db->query("update accounts set account_pwd='" . md5($n_passwd) . "' "
|
||||
. "where account_lid='" . $phpgw_info["user"]["userid"] . "'",__LINE__,__FILE__);
|
||||
}
|
||||
|
||||
if ($phpgw_info["server"]["auth_type"] == "ldap") {
|
||||
$ldap = ldap_connect($phpgw_info["server"]["ldap_host"]);
|
||||
|
||||
if (! @ldap_bind($ldap, $phpgw_info["server"]["ldap_root_dn"], $phpgw_info["server"]["ldap_root_pw"])) {
|
||||
echo "<p><b>Error binding to LDAP server. Check your config</b>";
|
||||
$phpgw->common->phpgw_exit();
|
||||
}
|
||||
|
||||
$entry["userpassword"] = $phpgw->common->encrypt_password($n_passwd);
|
||||
$entry["phpgw_lastpasswd_change"] = time();
|
||||
|
||||
$dn = $phpgw_info["user"]["account_dn"];
|
||||
@ldap_modify($ldap, $dn, $entry);
|
||||
}
|
||||
|
||||
// Update there last password change
|
||||
$phpgw->db->query("update accounts set account_lastpwd_change='" . time() . "' where account_id='"
|
||||
. $phpgw_info["user"]["account_id"] . "'",__LINE__,__FILE__);
|
||||
|
||||
$phpgw_info["user"]["passwd"] = $n_passwd;
|
||||
$o_passwd = $phpgw_info["user"]["passwd"];
|
||||
$phpgw_info["user"]["passwd"] = $phpgw->auth->change_password($o_passwd, $n_passwd);
|
||||
|
||||
$phpgw->accounts->sync();
|
||||
|
||||
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/preferences/","cd=18"));
|
||||
|
Loading…
Reference in New Issue
Block a user