当前位置: 首页>>代码示例>>PHP>>正文


PHP Redirect::intended方法代码示例

本文整理汇总了PHP中Redirect::intended方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::intended方法的具体用法?PHP Redirect::intended怎么用?PHP Redirect::intended使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Redirect的用法示例。


在下文中一共展示了Redirect::intended方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     if (\Auth::attempt(\Input::only('email', 'password'))) {
         return \Redirect::intended(route(\Config::get('admin.home_route')))->with('alert', array('type' => 'success', 'message' => 'Seja bem vindo.'));
     }
     return \Redirect::back()->withInput()->with('alert', array('type' => 'danger', 'message' => 'Usuário e/ou senha incorretos.'));
 }
开发者ID:hramose,项目名称:material-admin,代码行数:12,代码来源:SessionController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  * POST /properties
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('name' => 'required|max:50|', 'description' => 'required|max:400|min:10', 'ownerID' => 'required'));
     if ($v->passes()) {
         $agent_id = Sentry::getUser()->id;
         $property = new Property();
         $property->name = Input::get('name');
         $property->description = Input::get('description');
         $property->ownerID = Input::get('ownerID');
         $property->agent_id = $agent_id;
         $property->save();
         $newprop = Property::where('name', Input::get('name'))->first();
         $newprop_id = $newprop->id;
         foreach (Input::get('CBgroup1', array()) as $value) {
             $housedue = new Housedue();
             $housedue->propertyID = $newprop_id;
             $housedue->receivable = $value;
             $converted = strtolower(preg_replace("/[[:blank:]]+/", "_", $value));
             $housedue->db_name = $converted;
             $housedue->save();
         }
         return Redirect::intended('admin/property');
     }
     return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
 }
开发者ID:jeremiteki,项目名称:mteja-laravel,代码行数:32,代码来源:PropertiesController.php

示例3: getTagPosts

 public function getTagPosts($name)
 {
     try {
         $tag = Tag::where('name', $name)->first();
         if (!$tag) {
             throw new Exception("Tag not found");
         }
         $posts = $tag->posts()->paginate(8);
         $i = 0;
         foreach ($posts as $post) {
             if (!PrivacyHelper::checkPermission(Auth::user(), $post)) {
                 unset($posts[$i]);
                 $i++;
                 continue;
             }
             $i++;
             $post->makrdown = str_limit($post->makrdown, $limit = 500, $end = '...');
             $Parsedown = new Parsedown();
             $post->HTML = $Parsedown->text($post->makrdown);
         }
         if (Request::ajax()) {
             return View::make('posts._list')->with('data', $posts);
         } else {
             if (count($posts) == 0) {
                 return Redirect::intended(URL::action('ProfileController@getProfile', array($id)));
             }
             $this->layout->content = View::make('posts.list')->with('data', $posts);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:sh1nu11bi,项目名称:CloMa,代码行数:32,代码来源:BlogController.php

示例4: index

 public function index()
 {
     if (Session::has('user')) {
         Auth::login(Session::get('user'));
         if (Auth::user()->hak_akses == '1') {
             return Redirect::intended('hrdstaff');
         } elseif (Auth::user()->hak_akses == '2') {
             return Redirect::intended('hrdmanager');
         } elseif (Auth::user()->hak_akses == '3') {
             return Redirect::intended('direktur');
         } elseif (Auth::user()->hak_akses == '4') {
             return Redirect::intended('hrga');
         } elseif (Auth::user()->hak_akses == '5') {
             return Redirect::intended('keuangan');
         } elseif (Auth::user()->hak_akses == '6') {
             return Redirect::intended('karyawan');
         } elseif (Auth::user()->hak_akses == '7') {
             return Redirect::intended('pelamar');
         } else {
             return View::make('home');
         }
     } else {
         return View::make('home');
     }
 }
开发者ID:AlvaCorp,项目名称:ehrd,代码行数:25,代码来源:BaseController.php

示例5: login

 /**
  * Log in to site.
  *
  * @return Response
  */
 public function login()
 {
     if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true) || Auth::attempt(array('username' => Input::get('email'), 'password' => Input::get('password')), true)) {
         return Redirect::intended('dashboard');
     }
     return Redirect::back()->withInput(Input::except('password'))->with('message', 'Wrong creadentials!');
 }
开发者ID:Atiragram,项目名称:poit-labs,代码行数:12,代码来源:LoginController.php

示例6: login

 /**
  * Display customer login screen.
  * 
  * @return Response
  */
 public function login()
 {
     if (Auth::check()) {
         return Redirect::route('profile');
     } elseif (Request::isMethod('post')) {
         $loginValidator = Validator::make(Input::all(), array('email' => 'required', 'password' => 'required'));
         if ($loginValidator->passes()) {
             $inputCredentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
             if (Auth::attempt($inputCredentials)) {
                 $customer = Customer::find(Auth::id());
                 if ($customer->admin_ind) {
                     Session::put('AdminUser', TRUE);
                 }
                 if (is_null($customer->address)) {
                     // If customer does not have address, redirect to create address.
                     return Redirect::route('customer.address.create', Auth::id())->with('message', 'No address found for account.  Please enter a valid address.');
                 }
                 return Redirect::intended('profile')->with('message', 'Login successful.');
             }
             return Redirect::back()->withInput()->withErrors(array('password' => array('Credentials invalid.')));
         } else {
             return Redirect::back()->withInput()->withErrors($loginValidator);
         }
     }
     $this->layout->content = View::make('customers.login');
 }
开发者ID:marciocamello,项目名称:laravel-ecommerce,代码行数:31,代码来源:CustomersController.php

示例7: login

 public function login()
 {
     if (Input::has('url')) {
         // only allow local urls as redirect destinations
         $url = Input::get('url');
         if (!preg_match("~^(//|[^/]+:)~", $url)) {
             Session::flash('url.intended', $url);
         }
     }
     if (!$this->account->samlLogged()) {
         Auth::logout();
         $this->account->samlLogin();
     }
     if ($this->account->samlLogged()) {
         $id = $this->account->getSamlUniqueIdentifier();
         if (!$this->account->IdExists($id)) {
             if (Config::get('laravel-saml::saml.can_create', true)) {
                 $this->account->createUser();
             } else {
                 return Response::make(Config::get('laravel-saml::saml.can_create_error'), 400);
             }
         } else {
             if (!$this->account->laravelLogged()) {
                 $this->account->laravelLogin($id);
             }
         }
     }
     if ($this->account->samlLogged() && $this->account->laravelLogged()) {
         $intended = Session::get('url.intended');
         $intended = str_replace(Config::get('app.url'), '', $intended);
         Session::flash('url.intended', $intended);
         return Redirect::intended('/');
     }
 }
开发者ID:hbickerton,项目名称:laravel-saml,代码行数:34,代码来源:SamlController.php

示例8: postLogon

 public function postLogon()
 {
     $valid = Validator::make(Input::all(), ['email' => 'required|email', 'password' => 'required'], ['password.required' => trans('larauth::larauth.password_required')]);
     if ($valid->fails()) {
         return Redirect::route('larauth.logon')->with('errors', $valid->errors())->with(Input::all());
     }
     try {
         $user = Sentry::authenticate(['email' => Input::get('email'), 'password' => Input::get('password')], Input::get('remember'));
         // redirect to url before authetificate
         return Redirect::intended();
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         echo 'Login field is required.';
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         echo 'Password field is required.';
     } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
         //echo 'Wrong password, try again.';
         $valid->errors()->add('password', trans('larauth::larauth.wrong_password'));
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         echo 'User was not found.';
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         echo 'User is not activated.';
     } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
         //echo 'User is suspended.';
         $valid->errors()->add('password', trans('larauth::larauth.user_suspended'));
     } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
         echo 'User is banned.';
     }
     return Redirect::route('larauth.logon')->with('errors', $valid->errors())->with(Input::all());
 }
开发者ID:bitw,项目名称:larauth,代码行数:29,代码来源:LarauthController.php

示例9: logIn

 public function logIn()
 {
     //code to login user
     $validator = Validator::make(Input::all(), array('User_Name' => 'required', 'Password' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('login-get')->withErrors($validator)->withInput();
     } else {
         $auth = Auth::attempt(array('username' => Input::get('User_Name'), 'password' => Input::get('Password')));
         if ($auth) {
             // select the account to load and redirect to the intended page
             return Redirect::intended();
         } else {
             $auth2 = Auth::attempt(array('email' => Input::get('User_Name'), 'password' => Input::get('Password')));
             if ($auth2) {
                 // select the account to load and redirect to the intended page
                 return Redirect::intended();
             } else {
                 $auth3 = Auth::attempt(array('phone_number' => Input::get('User_Name'), 'password' => Input::get('Password')));
                 if ($auth3) {
                     // select the account to load and redirect to the intended page
                     return Redirect::intended();
                 } else {
                     return Redirect::route('login-get')->with('global', 'Username - Password Mismatch');
                 }
             }
         }
     }
 }
开发者ID:franqq,项目名称:openAdvertiser,代码行数:28,代码来源:AccountController.php

示例10: postLogin

 /**
  * Login action
  * @return Redirect
  */
 public function postLogin($target = 'admin')
 {
     $input = Input::all();
     $credentials = array('login' => $input['username'], 'password' => $input['password']);
     $remember = isset($input['remember']) && $input['remember'] == 'checked' ? true : false;
     try {
         $user = Sentry::authenticate($credentials, $remember);
         if ($user) {
             if (isset($input['api'])) {
                 return Response::json(array(), 200);
             } else {
                 return Redirect::intended($target);
             }
         }
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         if (isset($input['api'])) {
             return Response::json(array('error' => trans('users.check_activation_email')), 200);
         } else {
             return Redirect::back()->withErrors(trans('users.check_activation_email'));
         }
     } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
         if (isset($input['api'])) {
             return Response::json(array('error' => trans('users.account_suspended', array('minutes' => 10))), 200);
         } else {
             return Redirect::back()->withErrors(trans('users.account_suspended', array('minutes' => 10)));
         }
     } catch (Exception $e) {
         if (isset($input['api'])) {
             return Response::json(array('error' => trans('users.invalid_username_pw')), 200);
         } else {
             return Redirect::back()->withErrors(trans('users.invalid_username_pw'));
         }
     }
 }
开发者ID:doptor,项目名称:doptor,代码行数:38,代码来源:AuthController.php

示例11: postLogin

 public function postLogin()
 {
     try {
         // Login credentials
         $credentials = array('email' => Input::get('username'), 'password' => Input::get('password'));
         // Authenticate the user
         $user = Sentry::authenticate($credentials, false);
         return Redirect::intended('/');
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         $msg = 'Login field is required.';
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         $msg = 'Password field is required.';
     } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
         $msg = 'Wrong password, try again.';
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         $msg = 'User was not found.';
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         $msg = 'User is not activated.';
     } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
         $msg = 'User is suspended.';
     } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
         $msg = 'User is banned.';
     }
     return Redirect::to('auth/login')->withInput()->with('exception', $msg);
 }
开发者ID:gitda,项目名称:inventory2,代码行数:25,代码来源:AuthController.php

示例12: authentication

 /**
  * Authentication with Clef account
  *
  * @return Response
  */
 public function authentication()
 {
     $response = Clef::authentication($_GET['code']);
     // error
     if (!$response) {
         $error = 'Error';
         // error
     } elseif (isset($response['error'])) {
         $error = $response['error'];
         // success
     } elseif (isset($response['success'])) {
         // verif if exists account in Authentication table
         $verif = Authentication::whereprovider("clef")->whereprovider_uid($response['info']['id'])->first();
         // no account
         if (empty($verif)) {
             // Find account
         } else {
             // Find the user using the user id
             $user = User::find($verif->user_id);
             // RAZ logout
             if ($user->logout == 1) {
                 $user->logout = 0;
                 $user->save();
             }
             // Log the user in
             Auth::login($user);
             return Redirect::intended('/');
         }
         // error
     } else {
         $error = 'Unknown error';
     }
     return Redirect::to("login")->withErrors($error);
 }
开发者ID:maurocasas,项目名称:laravel-clef,代码行数:39,代码来源:ClefController.php

示例13: postIndex

 public function postIndex()
 {
     $rules = array('username' => 'required|alpha_dash', 'password' => 'required|min:8');
     $input = Input::all();
     $validator = Validator::make($input, $rules);
     $validator->sometimes('username', 'unique:users,name', function ($input) {
         return $input->action == 'register';
     });
     if ($validator->fails()) {
         return Redirect::to('login')->withErrors($validator);
     }
     if ($input['action'] == 'login') {
         if (Auth::attempt(array('name' => $input['username'], 'password' => $input['password']), Input::has('remember') ? true : false)) {
             return Redirect::to('/');
         } else {
             return Redirect::to('login')->withErrors(array('message' => Lang::get('login.error')));
         }
     } elseif ($input['action'] == 'register') {
         $user = new User();
         $user->name = $input['username'];
         $user->password = Hash::make($input['password']);
         $user->save();
         Auth::login($user);
         return Redirect::intended('/');
     }
 }
开发者ID:matrefeytontias,项目名称:ndless-apps,代码行数:26,代码来源:LoginController.php

示例14: postLogin

 /**
  * AdminUserController::postLogin()
  *
  * @return
  */
 public function postLogin()
 {
     $userService = new UserAccountService();
     $rules = array('email' => 'Required|email', 'password' => 'Required');
     $validator = \Validator::make(\Input::all(), $rules);
     if (!$validator->fails()) {
         $user = array('email' => \Input::get('email'), 'password' => \Input::get('password'));
         $remember = \Input::get('remember');
         $error = $userService->doLogin($user, $remember);
         if ($error == '') {
             $redirect = '';
             if (\Sentry::getUser()->hasAnyAccess(['system'])) {
                 $redirect = \Config::get('webshopauthenticate::admin_uri');
             } else {
                 $redirect = \Config::get('webshopauthenticate::uri') . '/myaccount';
             }
             return \Redirect::intended($redirect);
         }
         $error_msg = '';
         if ($error == 'Invalid') {
             $error_msg = \Lang::get('webshopauthenticate::auth/form.login.invalid_login');
         } else {
             if ($error == 'ToActivate') {
                 $error_msg = \Lang::get('webshopauthenticate::auth/form.login.account_not_confirmed');
             }
         }
         \Session::flash('error', $error_msg);
         return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/login')->withInput();
     } else {
         return \Redirect::to(\Config::get('webshopauthenticate::uri') . '/login')->withErrors($validator->messages())->withInput();
     }
 }
开发者ID:ahsanpackage,项目名称:webshopauthenticate,代码行数:37,代码来源:AuthController.php

示例15: store

 /**
  * Store a newly created session in storage.
  * POST /session
  *
  * @return Response
  */
 public function store()
 {
     // Attempt to login
     try {
         // Login credentials
         $credentials = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // Authenticate the user
         if (Auth::attempt($credentials)) {
             // Store Session values for user
             Session::put('email', $credentials['email']);
             Session::put('user_id', User::getIdFromEmail($credentials['email']));
             // Redirect to dashboard with message
             Session::flash('alert_success', 'Logged in successfully.');
             return Redirect::intended('dashboard');
         } else {
             Session::flash('alert_warning', 'Unable to login. Please check your username and password, and try again.');
             return Redirect::to(secure_url('/login'))->withInput();
         }
     } catch (\RuntimeException $e) {
         // An unexpected error occurred.
         Log::error(date("Y-m-d H:i:s") . '- RuntimeException in app/contorllers/SessionController: ' . '\\$data = ' . print_r($data) . $e);
         Session::flash('alert_danger', 'An unexpected error occurred.');
         return Redirect::to(secure_url('/login'))->withInput();
     }
 }
开发者ID:julianfresco,项目名称:mentorshipLog,代码行数:31,代码来源:SessionController.php


注:本文中的Redirect::intended方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。