From a584bf73b6d64dad98f150caba0f25e790cde010 Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Sun, 9 Apr 2023 04:50:17 +0300 Subject: user registration and login scenarios --- html/app/models/admin/User_model.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'html/app/models/admin') diff --git a/html/app/models/admin/User_model.php b/html/app/models/admin/User_model.php index 187da2d..397f198 100644 --- a/html/app/models/admin/User_model.php +++ b/html/app/models/admin/User_model.php @@ -188,6 +188,14 @@ class User_model } + /** activate + * + * check if activation code is valid; + * if valid, set account active; + * + * @param $ticket (hex/MD5): activation code; + * + */ public static function activate($ticket) { $user = Registry::use('database')->query( @@ -201,13 +209,13 @@ class User_model // remove activation code from user record Registry::use('database')->runQuery( "UPDATE user - SET activated = 1, `activation` = NULL + SET active = 1, `activation` = NULL WHERE activation = :ticket", [ 'ticket' => $ticket ] ); // update history - History::trackUserAccess($new_user_id, TRACK_ACCOUNT, 'User Account Activated'); + History::trackUserAccess($user['id'], TRACK_ACCOUNT, 'User Account Activated'); return true; -- cgit v1.2.3