_getAuth()->getUser(); $form = new UserSettingsForm($user); if ($this->request->isPost()) { $data = $this->request->getPost(); if ($form->isValid($data)) { $new_pw = $form->getValue('passwordNew'); if (strlen($new_pw) > 0) { $hash = password_hash($new_pw, PASSWORD_BCRYPT); // User had a password before. just update. if (strlen($user->getPassword()) > 0) { $user->setPassword($hash); } // Else we create a password link and email. else { $link = new PasswordLink(); $link->setUserId($user->getId()) ->setPassword($hash) ->save(); // TODO: Send the email here. $msg = "For security reasons. Before a password can be created " . "a email has been sent to {$user->getEmail()} with " . "a activation link."; $this->flash->notice($msg); } } $user->save(); $form->initialize(); $this->flash->message('success', 'Settings saved!'); } else { $this->flash->message('error', 'Could not save settings'); } } $this->view->form = $form; } public function activityAction($page = 1) { $user = $this->_getAuth()->getUser(); $paginator = ActivityLog::getPaginationList($user->getId(), $page); $this->view->page = $paginator->getPaginate(); $this->view->pagination_url = '/user/activity/'; } }