@@ 256-277 (lines=22) @@ | ||
253 | * User profile settings |
|
254 | * @throws ForbiddenException |
|
255 | */ |
|
256 | public function actionSettings() |
|
257 | { |
|
258 | // check if auth |
|
259 | if (!App::$User->isAuth()) { |
|
260 | throw new ForbiddenException(); |
|
261 | } |
|
262 | // get user object |
|
263 | $user = App::$User->identity(); |
|
264 | // create model and pass user object |
|
265 | $model = new FormSettings($user); |
|
266 | ||
267 | // check if form is submited |
|
268 | if ($model->send() && $model->validate()) { |
|
269 | $model->save(); |
|
270 | App::$Session->getFlashBag()->add('success', __('Profile data are successful updated')); |
|
271 | } |
|
272 | ||
273 | // render view |
|
274 | return App::$View->render('settings', [ |
|
275 | 'model' => $model->export() |
|
276 | ]); |
|
277 | } |
|
278 | ||
279 | /** |
|
280 | * Action change user password |
|
@@ 283-304 (lines=22) @@ | ||
280 | * Action change user password |
|
281 | * @throws ForbiddenException |
|
282 | */ |
|
283 | public function actionPassword() |
|
284 | { |
|
285 | // check if user is authed |
|
286 | if (!App::$User->isAuth()) { |
|
287 | throw new ForbiddenException(); |
|
288 | } |
|
289 | ||
290 | // get user object and create model with user object |
|
291 | $user = App::$User->identity(); |
|
292 | $model = new FormPasswordChange($user); |
|
293 | ||
294 | // check if form is submited and validation is passed |
|
295 | if ($model->send() && $model->validate()) { |
|
296 | $model->make(); |
|
297 | App::$Session->getFlashBag()->add('success', __('Password is successful changed')); |
|
298 | } |
|
299 | ||
300 | // set response output |
|
301 | return App::$View->render('password', [ |
|
302 | 'model' => $model->export() |
|
303 | ]); |
|
304 | } |
|
305 | ||
306 | /** |
|
307 | * Show users in blacklist and allow add new users |