/** * Register a new user */ public function actionRegister() { if ($this->_auth->isLogged()) { $this->_redirect('library'); } $user = User::get(); // validate form and model if ($this->_validForm($this->_request->getPost('form'), $user)) { // prepare for persistence and insert $user->prepare(); $user = UserDao::get()->insert($user); // log the user in and redirect $this->_auth->forceLogin($user); $this->_redirect('library/index/' . $user->UserId); } // prepare the view $this->addView('user/register', 'content'); $this->pagetitle = 'Register'; $this->content->user = $user; }
/** * Updates a user * @param User $user * @param <type> $field * @return <type> */ public function update(User $user) { $data = $user->toArray(); $this->_update($this->_pkey, $data); }