summaryrefslogtreecommitdiff
path: root/public/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/models')
-rw-r--r--public/app/models/Access_model.php37
-rw-r--r--public/app/models/Content_model.php5
2 files changed, 38 insertions, 4 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
## -------------------------------------------------------------------------
diff --git a/public/app/models/Content_model.php b/public/app/models/Content_model.php
index 1f145a0..cfe418f 100644
--- a/public/app/models/Content_model.php
+++ b/public/app/models/Content_model.php
@@ -91,7 +91,10 @@ class Content_model {
public static function all_petitions()
{
return Registry::use('database')->runQuery(
- "SELECT * FROM petition",
+ "SELECT petition.*,
+ CONCAT(user.last_name, ' ', user.first_name) as UserName
+ FROM petition
+ LEFT JOIN user ON user.id = petition.user_id",
[]
);
}