public function processChangePassword(Form $form, $values) { $this->onBeforeChange($form, $this->user); try { $this->user->password = $values['password']; $this->usersFacade->saveUser($this->user); } catch (\Exception $e) { $this->onError($form, $this->user); } $this->onSuccess($form, $this->user); }
public function processSaveWholeName(Form $form, $values) { $user = $this->user->getIdentity(); $user->name = $values['name']; try { $this->usersFacade->saveUser($user); $this->flashMessage('Vaše jméno bylo úspěšně změněno.', 'success'); $this->redirect('this'); } catch (\Exception $e) { $this->flashMessage('Jméno nemohlo být změněno. Zkuste akci opakovat později.', 'error'); return; } }
private function toggleAccountAccessibility($id) { try { $this->checkPermission($id); $user = $this->getUser($id); if ($user !== null) { $user->toggleAccessibility(); $this->usersFacade->saveUser($user); } else { $this->redirect('this'); } return $user; } catch (\Exception $e) { $this->flashMessage('Nastala uzavírání/otevírání účtu nastala chyba.', 'error'); $this->redirect('this'); } }