diff options
Diffstat (limited to 'public/app/models')
| -rw-r--r-- | public/app/models/Access_model.php | 57 | ||||
| -rw-r--r-- | public/app/models/Office_model.php (renamed from public/app/models/Cms_model.php) | 0 | ||||
| -rw-r--r-- | public/app/models/_info.md | 21 |
3 files changed, 58 insertions, 20 deletions
diff --git a/public/app/models/Access_model.php b/public/app/models/Access_model.php index 8d446dc..8a2e5ce 100644 --- a/public/app/models/Access_model.php +++ b/public/app/models/Access_model.php @@ -3,6 +3,7 @@ namespace app\models; use \Registry; +use app\extends\App_manager; use app\models\History_model; class Access_model @@ -148,36 +149,52 @@ class Access_model } - /** activate + /** activate_set_password * - * check if activation code is valid; - * if valid, set account active; + * activate user and set password * * @param $ticket (hex/MD5): activation code; * */ - public static function activate($ticket) + public static function activate_set_password($post, $password) { - $user = Registry::use('database')->query( - "SELECT * FROM user WHERE activation = :ticket", - [ 'ticket' => $ticket ] - )->getFirst(); - - // if no user with this activation code, return false - if ($user === false) return false; - - // remove activation code from user record - Registry::use('database')->runQuery( + // Update and set activate = true + $rowCount = Registry::use('database')->query( "UPDATE user - SET active = 1, `activation` = NULL - WHERE activation = :ticket", - [ 'ticket' => $ticket ] - ); + SET first_name = :first_name, + last_name = :last_name, + email = :email, + father_name = :father_name, + registration_number = :registration_number, + sector = :sector, + belonging_school = :belonging_school, + position = :position, + phone = :phone, + `password` = :password, + invitation = NULL, + active = :active + WHERE id = :id AND invitation = :invitation", + [ + ':first_name' => $post['first_name'], + ':last_name' => $post['last_name'], + ':email' => $post['email'], + ':father_name' => $post['father_name'], + ':registration_number' => $post['registration_number'], + ':sector' => $post['sector'], + ':belonging_school' => $post['belonging_school'], + ':position' => $post['position'], + ':phone' => $post['phone'], + ':password' => $password, + ':active' => 1, + ':id' => $post['id'], + ':invitation' => $post['invitation'] + ] + )->rowCount(); // update history - History_model::trackUserAccess($user['id'], TRACK_ACCOUNT, 'User Account Activated'); + History_model::trackUserAccess($post['id'], TRACK_ACCOUNT, 'User Account Activated'); - return true; + return $rowCount; } diff --git a/public/app/models/Cms_model.php b/public/app/models/Office_model.php index fad11b8..fad11b8 100644 --- a/public/app/models/Cms_model.php +++ b/public/app/models/Office_model.php diff --git a/public/app/models/_info.md b/public/app/models/_info.md index 82143bf..ac6d334 100644 --- a/public/app/models/_info.md +++ b/public/app/models/_info.md @@ -150,3 +150,24 @@ $myobject = new myclass(); call_user_func(array($myobject, 'say_hello')); ?> + + + + +# APPlication + +\ controllers + [ ] App + [ ] Auth + +\ extends + [ ] Cache_service + [*] App_manager + [*] App_user + [ ] SendMail_service + [ ] Form_builder + + +\ models + [ ] Access_model + [ ] History_model
\ No newline at end of file |
