| @@ 137-142 (lines=6) @@ | ||
| 134 | $usersModel = Models\Users::instance(); |
|
| 135 | $uuid = $f3->get('REQUEST.uuid'); |
|
| 136 | $usersMapper = $usersModel->getUserByUUID($uuid); |
|
| 137 | if (null == $usersMapper->id) { |
|
| 138 | $this->notify(_('The account no longer exists!'), 'error'); |
|
| 139 | $f3->set('form', $f3->get('REQUEST')); |
|
| 140 | echo \View::instance()->render('user/account.phtml'); |
|
| 141 | return; |
|
| 142 | } |
|
| 143 | $oldUserMapper = clone $usersMapper; |
|
| 144 | ||
| 145 | // only allow updating of these fields |
|
| @@ 162-167 (lines=6) @@ | ||
| 159 | ||
| 160 | // load in the forgot password reset code row |
|
| 161 | $usersDataMapper->load([$db->quotekey('value')." = ? AND ".$db->quotekey('key')." = 'forgot-password-code'", $f3->get('REQUEST.code')]); |
|
| 162 | if (null == $usersDataMapper->uuid) { |
|
| 163 | $this->notify(_('Unknown password reset code!'), 'error'); |
|
| 164 | $f3->set('form', $f3->get('REQUEST')); |
|
| 165 | echo \View::instance()->render($viewStep2); |
|
| 166 | return; |
|
| 167 | } |
|
| 168 | ||
| 169 | // check that the user exists for the reset code |
|
| 170 | $usersMapper->load(['uuid = ?', $usersDataMapper->users_uuid]); |
|
| @@ 171-176 (lines=6) @@ | ||
| 168 | ||
| 169 | // check that the user exists for the reset code |
|
| 170 | $usersMapper->load(['uuid = ?', $usersDataMapper->users_uuid]); |
|
| 171 | if (null == $usersDataMapper->uuid) { |
|
| 172 | $this->notify(_('Unknown user for reset code!'), 'error'); |
|
| 173 | $f3->set('form', $f3->get('REQUEST')); |
|
| 174 | echo \View::instance()->render($viewStep2); |
|
| 175 | return; |
|
| 176 | } |
|
| 177 | ||
| 178 | // valid data, show the reset password form |
|
| 179 | $this->notify(_("Password code is valid."), 'info'); |
|
| @@ 74-79 (lines=6) @@ | ||
| 71 | ||
| 72 | // find user by email address |
|
| 73 | $usersMapper = $usersModel->getUserByEmail($f3->get('REQUEST.email')); |
|
| 74 | if (null == $usersMapper->id) { |
|
| 75 | $this->notify(_('No user found with that email!'), 'error'); |
|
| 76 | $f3->set('form', $f3->get('REQUEST')); |
|
| 77 | echo \View::instance()->render($view); |
|
| 78 | return; |
|
| 79 | } |
|
| 80 | ||
| 81 | // check the password is set |
|
| 82 | $password = $f3->get('REQUEST.password'); |
|
| @@ 151-156 (lines=6) @@ | ||
| 148 | // get current user details |
|
| 149 | $usersModel = Models\Users::instance(); |
|
| 150 | $usersMapper = $usersModel->getUserByUUID($f3->get('uuid')); |
|
| 151 | if (null == $usersMapper->id) { |
|
| 152 | $this->notify(_('Your account no longer exists!'), 'error'); |
|
| 153 | $f3->set('form', $f3->get('REQUEST')); |
|
| 154 | echo \View::instance()->render('user/account.phtml'); |
|
| 155 | return; |
|
| 156 | } |
|
| 157 | ||
| 158 | // check password is correct |
|
| 159 | $str = Helpers\Str::instance(); |
|
| @@ 334-339 (lines=6) @@ | ||
| 331 | // find user by email address |
|
| 332 | $usersModel = Models\Users::instance(); |
|
| 333 | $usersMapper = $usersModel->getUserByEmail($email); |
|
| 334 | if (null !== $usersMapper->id) { |
|
| 335 | $this->notify(_('That user already exists!'), 'error'); |
|
| 336 | $f3->set('form', $f3->get('REQUEST')); |
|
| 337 | echo \View::instance()->render($view); |
|
| 338 | return; |
|
| 339 | } |
|
| 340 | ||
| 341 | // bad password |
|
| 342 | $password = $f3->get('REQUEST.password'); |
|