Bug fix for #606
This commit is contained in:
parent
b740e660b8
commit
bcc986fa11
|
@ -87,6 +87,13 @@ class dbUsers extends dbJSON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set a new password
|
||||||
|
if (!empty($args['password'])) {
|
||||||
|
$user['salt'] = $this->generateSalt();
|
||||||
|
$user['password'] = $this->generatePasswordHash($args['password'], $user['salt']);
|
||||||
|
$user['tokenAuth'] = $this->generateAuthToken();
|
||||||
|
}
|
||||||
|
|
||||||
// Save the database
|
// Save the database
|
||||||
$this->db[$args['username']] = $user;
|
$this->db[$args['username']] = $user;
|
||||||
return $this->save();
|
return $this->save();
|
||||||
|
@ -142,14 +149,8 @@ class dbUsers extends dbJSON
|
||||||
|
|
||||||
public function setPassword($username, $password)
|
public function setPassword($username, $password)
|
||||||
{
|
{
|
||||||
$salt = $this->generateSalt();
|
|
||||||
$hash = $this->generatePasswordHash($password, $salt);
|
|
||||||
$tokenAuth = $this->generateAuthToken();
|
|
||||||
|
|
||||||
$args['username'] = $username;
|
$args['username'] = $username;
|
||||||
$args['salt'] = $salt;
|
|
||||||
$args['password'] = $hash;
|
$args['password'] = $hash;
|
||||||
$args['tokenAuth'] = $tokenAuth;
|
|
||||||
|
|
||||||
return $this->set($args);
|
return $this->set($args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue