Exemplo n.º 1
0
 /**
  * Register page
  * Show the register form, but redirect to main-page if user is already logged-in
  */
 public function index()
 {
     if (LoginModel::isUserLoggedIn()) {
         Redirect::home();
     } else {
         $this->View->render('register/index');
     }
 }
Exemplo n.º 2
0
 /**
  * This method controls what happens when you move to /overview/showProfile in your app.
  * Shows the (public) details of the selected user.
  * @param $user_id int id the the user
  */
 public function showProfile($user_id)
 {
     if (isset($user_id)) {
         $this->View->render('profile/showProfile', array('user' => UserModel::getPublicProfileOfUser($user_id)));
     } else {
         Redirect::home();
     }
 }
Exemplo n.º 3
0
 /**
  * Edit user name (perform the real action after form has been submitted)
  */
 public function editUsername_action()
 {
     // check if csrf token is valid
     if (!Csrf::isTokenValid()) {
         LoginModel::logout();
         Redirect::home();
         \Huge\Core\Application::stop();
     }
     UserModel::editUserName(Request::post('user_name'));
     Redirect::to('user/editUsername');
 }
Exemplo n.º 4
0
 /**
  * The logout action
  * Perform logout, redirect user to main-page
  */
 public function logout()
 {
     LoginModel::logout();
     Redirect::home();
     \Huge\Core\Application::stop();
 }