@@ 281-302 (lines=22) @@ | ||
278 | * @throws \Ffcms\Core\Exception\NativeException |
|
279 | * @throws ForbiddenException |
|
280 | */ |
|
281 | public function actionSettings() |
|
282 | { |
|
283 | // check if auth |
|
284 | if (!App::$User->isAuth()) { |
|
285 | throw new ForbiddenException(); |
|
286 | } |
|
287 | // get user object |
|
288 | $user = App::$User->identity(); |
|
289 | // create model and pass user object |
|
290 | $model = new FormSettings($user); |
|
291 | ||
292 | // check if form is submited |
|
293 | if ($model->send() && $model->validate()) { |
|
294 | $model->save(); |
|
295 | App::$Session->getFlashBag()->add('success', __('Profile data are successful updated')); |
|
296 | } |
|
297 | ||
298 | // render view |
|
299 | return App::$View->render('settings', [ |
|
300 | 'model' => $model->filter() |
|
301 | ]); |
|
302 | } |
|
303 | ||
304 | /** |
|
305 | * Action change user password |
|
@@ 311-332 (lines=22) @@ | ||
308 | * @throws \Ffcms\Core\Exception\NativeException |
|
309 | * @throws ForbiddenException |
|
310 | */ |
|
311 | public function actionPassword() |
|
312 | { |
|
313 | // check if user is authed |
|
314 | if (!App::$User->isAuth()) { |
|
315 | throw new ForbiddenException(); |
|
316 | } |
|
317 | ||
318 | // get user object and create model with user object |
|
319 | $user = App::$User->identity(); |
|
320 | $model = new FormPasswordChange($user); |
|
321 | ||
322 | // check if form is submited and validation is passed |
|
323 | if ($model->send() && $model->validate()) { |
|
324 | $model->make(); |
|
325 | App::$Session->getFlashBag()->add('success', __('Password is successful changed')); |
|
326 | } |
|
327 | ||
328 | // set response output |
|
329 | return App::$View->render('password', [ |
|
330 | 'model' => $model->filter() |
|
331 | ]); |
|
332 | } |
|
333 | ||
334 | /** |
|
335 | * Show users in blacklist and allow add new users |