Change user password

This commit is contained in:
Diego Najar 2015-06-09 19:55:23 -03:00
parent 1c4962c570
commit 5c4262e2ec
2 changed files with 12 additions and 1 deletions

View File

@ -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.');

View File

@ -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();