summaryrefslogtreecommitdiff
path: root/public/app/models/Access_model.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/models/Access_model.php')
-rw-r--r--public/app/models/Access_model.php37
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
## -------------------------------------------------------------------------