@@ 321-342 (lines=22) @@ | ||
318 | * @throws \Ffcms\Core\Exception\NativeException |
|
319 | * @throws ForbiddenException |
|
320 | */ |
|
321 | public function actionSettings() |
|
322 | { |
|
323 | // check if auth |
|
324 | if (!App::$User->isAuth()) { |
|
325 | throw new ForbiddenException(); |
|
326 | } |
|
327 | // get user object |
|
328 | $user = App::$User->identity(); |
|
329 | // create model and pass user object |
|
330 | $model = new FormSettings($user); |
|
331 | ||
332 | // check if form is submited |
|
333 | if ($model->send() && $model->validate()) { |
|
334 | $model->save(); |
|
335 | App::$Session->getFlashBag()->add('success', __('Profile data are successful updated')); |
|
336 | } |
|
337 | ||
338 | // render view |
|
339 | return App::$View->render('settings', [ |
|
340 | 'model' => $model->filter() |
|
341 | ]); |
|
342 | } |
|
343 | ||
344 | /** |
|
345 | * Action change user password |
|
@@ 351-372 (lines=22) @@ | ||
348 | * @throws \Ffcms\Core\Exception\NativeException |
|
349 | * @throws ForbiddenException |
|
350 | */ |
|
351 | public function actionPassword() |
|
352 | { |
|
353 | // check if user is authed |
|
354 | if (!App::$User->isAuth()) { |
|
355 | throw new ForbiddenException(); |
|
356 | } |
|
357 | ||
358 | // get user object and create model with user object |
|
359 | $user = App::$User->identity(); |
|
360 | $model = new FormPasswordChange($user); |
|
361 | ||
362 | // check if form is submited and validation is passed |
|
363 | if ($model->send() && $model->validate()) { |
|
364 | $model->make(); |
|
365 | App::$Session->getFlashBag()->add('success', __('Password is successful changed')); |
|
366 | } |
|
367 | ||
368 | // set response output |
|
369 | return App::$View->render('password', [ |
|
370 | 'model' => $model->filter() |
|
371 | ]); |
|
372 | } |
|
373 | ||
374 | /** |
|
375 | * Show users in blacklist and allow add new users |