Example #1
0
 /**
  * Login a user
  *
  * @return mixed
  */
 public function attempt()
 {
     $login = new LoginProcess();
     return $login->execute(function () {
         return Route::redirect('login');
     });
 }
Example #2
0
 /**
  * Determines whether a user is authenticated
  * by checking keys if they are valid.
  *
  * @return mixed
  **/
 public function guard()
 {
     if (!isset($_SESSION['user'])) {
         return Route::redirect(route('login'));
     } else {
         if (!Token::verify(Session::user()->remember_token)) {
             return $this->restartSession();
         }
     }
     return true;
 }
Example #3
0
 /**
  * Execute the Process
  *
  * @todo execute
  * @param $callback
  * @return mixed
  */
 public function execute($callback = "")
 {
     $request = new LoginRequest($_POST);
     if ($request->validate()) {
         $attempt = User::where('username', $request->get('username'))->where('password', Hash::encode($request->get('password')))->where('active', 'yes');
         if ($attempt->exists()) {
             $user = $attempt->first();
             $user->remember_token = Token::create();
             $user->save();
             $_SESSION['user'] = $user();
             return Route::redirect('welcome');
         } else {
             Session::setFlash('flash', 'username/password is incorrect.<br><br>');
             return $callback();
         }
     } else {
         return $callback();
     }
 }
Example #4
0
    if ($user) {
        if (array_key_exists('post', $_GET) && array_key_exists('s', $_GET)) {
            $id = test_input($_GET['post']);
            $poi = $contributionController->find($id);
            if ($poi) {
                $action = test_input($_GET['s']);
                switch ($action) {
                    case "a":
                        $poi->setStatus("A");
                        $contributionController->update($poi);
                        Route::redirect($_SERVER['HTTP_REFERER']);
                        break;
                    case "r":
                        $poi->setStatus("R");
                        $contributionController->update($poi);
                        Route::redirect($_SERVER['HTTP_REFERER']);
                        break;
                    default:
                        Route::get404Error();
                        break;
                }
            } else {
                Route::get404Error();
            }
        } else {
            Route::get404Error();
        }
    } else {
        Route::get404Error();
    }
} else {
Example #5
0
 /**
  * Alternative to Route::redirect()
  *
  * @param $route
  * @return string
  **/
 function redirect($route)
 {
     return Route::redirect($route);
 }
Example #6
0
function redirect($url)
{
    return Route::redirect(URL . $url);
}