Beispiel #1
0
 /**
  * Page that is used for new users to register on this website. There is also a similar page on admin module called
  * admin/users/create where admins can create a new user. When an admin create an user then the password is generated
  * automatically and sent to user email address. So not even the admin can see it, just the new user.
  */
 public function actionRegister()
 {
     if (WebApp::get()->user()->isConnected()) {
         // can't register if is already connected
         WebApp::get()->request()->goToPage('home');
     }
     $user = new \app\models\User();
     $user->setAction('register');
     if (isset($_POST['register']) && $user->setAttributes($_POST['User'])->validate()) {
         if ($user->register()) {
             Messages::get()->success('Account created!');
             WebApp::get()->request()->goToPage('home');
         }
     }
     $this->assign('user', $user);
 }