Ejemplo 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');
     }
 }
Ejemplo n.º 2
0
 /**
  * Detects if there is concurrent session (i.e. another user logged in with the same current user credentials),
  * If so, then logout.
  */
 public static function checkSessionConcurrency()
 {
     if (Session::userIsLoggedIn()) {
         if (Session::isConcurrentSessionExists()) {
             \Huge\Model\LoginModel::logout();
             Redirect::home();
             Application::stop();
         }
     }
 }
Ejemplo 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');
 }
Ejemplo n.º 4
0
 /**
  * Login with cookie
  */
 public function loginWithCookie()
 {
     // run the loginWithCookie() method in the login-model, put the result in $login_successful (true or false)
     $login_successful = LoginModel::loginWithCookie(Request::cookie('remember_me'));
     // if login successful, redirect to dashboard/index ...
     if ($login_successful) {
         Redirect::to('dashboard/index');
     } else {
         // if not, delete cookie (outdated? attack?) and route user to login form to prevent infinite login loops
         LoginModel::deleteCookie();
         Redirect::to('login/index');
     }
 }