diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-06 00:46:19 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-06 00:46:19 +0300 |
| commit | 1388a64651f1c61a6aafc32f8e3e60f7a6ffd339 (patch) | |
| tree | dd5bcd7b438929ffec89d32011144831eebabb06 /public/app/models/Access_model.php | |
| parent | d5475ce60729c3f743a6451b42072f1a13ffed59 (diff) | |
| download | gyraf1gov-1388a64651f1c61a6aafc32f8e3e60f7a6ffd339.tar.gz gyraf1gov-1388a64651f1c61a6aafc32f8e3e60f7a6ffd339.tar.bz2 gyraf1gov-1388a64651f1c61a6aafc32f8e3e60f7a6ffd339.zip | |
admin petition ready
Diffstat (limited to 'public/app/models/Access_model.php')
| -rw-r--r-- | public/app/models/Access_model.php | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/public/app/models/Access_model.php b/public/app/models/Access_model.php index 2d36285..c98b6c4 100644 --- a/public/app/models/Access_model.php +++ b/public/app/models/Access_model.php @@ -12,7 +12,7 @@ class Access_model ## User methods ## ------------------------------------------------------------------------- - /** check user (by index key) + /** check user (by index key = Email) * * @param $indexKey (string) : key for user identification * @param $value (string) @@ -135,8 +135,8 @@ class Access_model * * activate user and set password * - * @param $ticket (hex/MD5): activation code; - * + * @param array $post + * @param string $password: hased-password */ public static function activate_set_password($post, $password) { @@ -233,6 +233,37 @@ class Access_model } + /** update_password + * + * (re)set user's password + * + * @param int $id: user id + * @param string $hashpass: hashed password + */ + public static function update_password($uid, $hashpass) + { + // Update and set activate = true + $rowCount = Registry::use('database')->query( + "UPDATE user + SET `password` = :hashpass + WHERE id = :id", + [ + ':hashpass' => $hashpass, + ':id' => $uid + ] + )->rowCount(); + + // update history + if ($rowCount != 0) { + History_model::trackUserAccess( + $uid, TRACK_ACCOUNT, 'User password changed' + ); + } + + return $rowCount; + } + + ## Set permission methods ## ------------------------------------------------------------------------- |
