aboutsummaryrefslogtreecommitdiff
path: root/models/user.php
diff options
context:
space:
mode:
Diffstat (limited to 'models/user.php')
-rw-r--r--models/user.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/models/user.php b/models/user.php
index 71cf07d..6ff2f70 100644
--- a/models/user.php
+++ b/models/user.php
@@ -60,16 +60,18 @@ class User extends Table {
private static $AnonUID = 1;
- function update(string $Username, string $Password = null) {
+ function update(string $Username = null, string $Password = null, string $Role = null) {
// Applicable to Anon user
if ($this->Password === '') {
throw new Exception('Not modifying system account!');
}
+ $Username = $Username ?? $this->Username;
$Password = ($Password === null) ? $this->Password : password_hash($Password, PASSWORD_BCRYPT);
+ $Role = $Role ?? $this->Role;
Table::_update(
'Users',
- "Username = \"$Username\", Password = \"$Password\"",
+ "Username = \"$Username\", Password = \"$Password\", Role = \"$Role\"",
"UID = \"$this->UID\""
);
}