Change user password
This commit is contained in:
parent
1c4962c570
commit
5c4262e2ec
@ -11,7 +11,7 @@ function editUser($args)
|
||||
if(isset($args['password']))
|
||||
{
|
||||
if( ($args['password']===$args['confirm-password']) && !Text::isEmpty($args['password']) ) {
|
||||
return $dbUsers->set($args);
|
||||
return $dbUsers->setPassword($args);
|
||||
}
|
||||
else {
|
||||
Alert::set('Passwords are differents.');
|
||||
|
@ -42,6 +42,17 @@ class dbUsers extends dbJSON
|
||||
return $this->db;
|
||||
}
|
||||
|
||||
public function setPassword($args)
|
||||
{
|
||||
$salt = Text::randomText(SALT_LENGTH);
|
||||
$hash = sha1($args['password'].$salt);
|
||||
|
||||
$args['salt'] = $salt;
|
||||
$args['password'] = $hash;
|
||||
|
||||
return $this->set($args);
|
||||
}
|
||||
|
||||
public function set($args)
|
||||
{
|
||||
$dataForDb = array();
|
||||
|
Loading…
Reference in New Issue
Block a user