LSformElement :: password : Added support of verify feature for non login password

This commit is contained in:
Benjamin Renard 2011-05-01 16:44:32 +02:00
parent 47e2c56907
commit e9d72a6c10

View file

@ -60,14 +60,12 @@ class LSformElement_password extends LSformElement {
return true;
}
if (!isset($this -> params['html_options']['isLoginPassword']) || $this -> params['html_options']['isLoginPassword']) {
if ($this -> verifyPassword($return[$this -> name][0])) {
LSdebug("Password : no change");
unset($return[$this -> name]);
$this -> form -> _notUpdate[$this -> name] == true;
return true;
}
}
//Mail
if (isset($_POST['LSformElement_password_'.$this -> name.'_send'])) {
@ -164,8 +162,19 @@ class LSformElement_password extends LSformElement {
if ($this -> attr_html -> attribute -> ldapObject -> isNew()) {
return false;
}
if ($this -> isLoginPassword()) {
return LSsession :: checkUserPwd($this -> attr_html -> attribute -> ldapObject,$pwd);
}
else {
$hash = $this -> attr_html -> attribute -> ldap -> encodePassword($pwd);
$find=false;
foreach($this -> attr_html -> attribute -> data as $val) {
if ($hash == $val)
$find=true;
}
return $find;
}
}
function send($params) {
if (is_array($this -> sendMail)) {
@ -258,6 +267,13 @@ class LSformElement_password extends LSformElement {
}
}
public function isLoginPassword() {
if (!isset($this -> params['html_options']['isLoginPassword']) || $this -> params['html_options']['isLoginPassword']) {
return true;
}
return false;
}
}
?>