| @@ 175-193 (lines=19) @@ | ||
| 172 | $str = Helpers\Str::instance(); |
|
| 173 | $password = $f3->get('REQUEST.password'); |
|
| 174 | $confirm_password = $f3->get('REQUEST.confirm_password'); |
|
| 175 | if (!empty($password) || !empty($confirm_password)) { |
|
| 176 | if ($password !== $confirm_password) { |
|
| 177 | $this->notify(_('That password and confirm password must match!'), 'warning'); |
|
| 178 | $f3->set('form', $f3->get('REQUEST')); |
|
| 179 | echo \View::instance()->render($view); |
|
| 180 | return; |
|
| 181 | } elseif ($str->passwordVerify($usersMapper->password, $password)) { |
|
| 182 | $this->notify(_('The new password and old password are the same!'), 'warning'); |
|
| 183 | $f3->set('form', $f3->get('REQUEST')); |
|
| 184 | echo \View::instance()->render($view); |
|
| 185 | return; |
|
| 186 | } else { |
|
| 187 | // set new hashed password |
|
| 188 | $data['password'] = $str->password($password); |
|
| 189 | } |
|
| 190 | } else { |
|
| 191 | // same password |
|
| 192 | $data['password'] = $usersMapper->password; |
|
| 193 | } |
|
| 194 | ||
| 195 | // check if email address change that email isn't taken |
|
| 196 | $email = $f3->get('REQUEST.email'); |
|
| @@ 194-212 (lines=19) @@ | ||
| 191 | // is this a password change? if so, check they match |
|
| 192 | $password = $f3->get('REQUEST.password'); |
|
| 193 | $confirm_password = $f3->get('REQUEST.confirm_password'); |
|
| 194 | if (!empty($password) || !empty($confirm_password)) { |
|
| 195 | if ($password !== $confirm_password) { |
|
| 196 | $this->notify(_('That password and confirm password must match!'), 'warning'); |
|
| 197 | $f3->set('form', $f3->get('REQUEST')); |
|
| 198 | echo \View::instance()->render($view); |
|
| 199 | return; |
|
| 200 | } elseif ($str->passwordVerify($usersMapper->password, $password)) { |
|
| 201 | $this->notify(_('The new password and old password are the same!'), 'warning'); |
|
| 202 | $f3->set('form', $f3->get('REQUEST')); |
|
| 203 | echo \View::instance()->render($view); |
|
| 204 | return; |
|
| 205 | } else { |
|
| 206 | // set new hashed password |
|
| 207 | $data['password'] = $str->password($password); |
|
| 208 | } |
|
| 209 | } else { |
|
| 210 | // same password |
|
| 211 | $data['password'] = $usersMapper->password; |
|
| 212 | } |
|
| 213 | ||
| 214 | // check if email address change that email isn't taken |
|
| 215 | $email = $f3->get('REQUEST.email'); |
|