diff options
Diffstat (limited to 'models/user.php')
| -rw-r--r-- | models/user.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/models/user.php b/models/user.php index 1f58e7c..71cf07d 100644 --- a/models/user.php +++ b/models/user.php @@ -60,6 +60,20 @@ class User extends Table { private static $AnonUID = 1; + function update(string $Username, string $Password = null) { + // Applicable to Anon user + if ($this->Password === '') { + throw new Exception('Not modifying system account!'); + } + + $Password = ($Password === null) ? $this->Password : password_hash($Password, PASSWORD_BCRYPT); + Table::_update( + 'Users', + "Username = \"$Username\", Password = \"$Password\"", + "UID = \"$this->UID\"" + ); + } + function delete() { // Applicable to Anon user if ($this->Password === '') { |
