本文整理汇总了PHP中Illuminate\Support\Facades\Redirect::intended方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::intended方法的具体用法?PHP Redirect::intended怎么用?PHP Redirect::intended使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Redirect
的用法示例。
在下文中一共展示了Redirect::intended方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postLogin
/**
* @param Request $request
*
* @return mixed
*/
public function postLogin(Request $request)
{
$credentials = $request->only(['username', 'password']);
$validator = Validator::make($credentials, ['username' => 'required', 'password' => 'required']);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator);
}
if (Auth::guard('admin')->attempt($credentials)) {
return Redirect::intended(config('admin.prefix'));
}
return Redirect::back()->withInput()->withErrors(['username' => $this->getFailedLoginMessage()]);
}
示例2: postLogin
public function postLogin()
{
$input = Input::all();
$attempt = Auth::attempt(array('email' => $input['email'], 'password' => $input['password'], 'confirmed' => 1));
if ($attempt) {
if (Request::ajax()) {
return Response::json(array('user' => Auth::user()));
} else {
return Redirect::intended('home');
}
} else {
//Attempt again without checking 'confirmed'
$attempt = Auth::validate(array('email' => $input['email'], 'password' => $input['password']));
if ($attempt) {
//Credentials are correct. but email not verified
$error = __('emailNotConfirmedYet');
$emailNotConfirmed = true;
} else {
$error = __('emailOrPasswordIncorrect');
}
if (Request::ajax()) {
return Response::json(array('error' => $error, 'emailNotConfirmed' => !empty($emailNotConfirmed) ? true : false), 400);
} else {
return Redirect::to(route('login'))->with('login:errors', [$error])->withInput();
}
}
}
示例3: register
public function register()
{
if (Request::isMethod('post')) {
User::create(['name' => Request::get('name'), 'email' => Request::get('email'), 'password' => bcrypt(Request::get('password'))]);
}
return Redirect::intended('/');
}
示例4: postLogin
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function postLogin(Request $request)
{
$input = $request->only('email', 'password', 'type');
$remember = $request->get('rememberme');
try {
// Authenticate the user
$user = User::authenticate($input, $remember);
return Redirect::intended('/admin');
} catch (\Lavalite\user\Exceptions\LoginRequiredException $e) {
$result = 'Login field is required.';
} catch (\Lavalite\user\Exceptions\PasswordRequiredException $e) {
$result = 'Password field is required.';
} catch (\Lavalite\user\Exceptions\WrongPasswordException $e) {
$result = 'Wrong password, try again.';
} catch (\Lavalite\user\Exceptions\UserNotFoundException $e) {
$result = $e->getMessage();
//'User was not found.';
} catch (\Lavalite\user\Exceptions\UserNotActivatedException $e) {
$result = 'User is not activated.';
} catch (\Lavalite\user\Exceptions\UserSuspendedException $e) {
$result = 'User is suspended.';
} catch (\Lavalite\user\Exceptions\UserBannedException $e) {
$result = 'User is banned.';
}
Session::flash('error', $result);
return Redirect::to('admin/login')->withInput();
}
示例5: login
protected function login()
{
if (auth()->attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true) || auth()->attempt(array('name' => Input::get('email'), 'password' => Input::get('password')), true)) {
return Redirect::intended('/');
}
return back()->withInput()->with('message', 'Неверное имя пользователя и/или пароль!');
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next, ...$roles)
{
if (!$this->user->hasRole($roles)) {
return Redirect::intended('/users/members');
}
return $next($request);
}
示例7: postLogin
/**
* Logs the user in.
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postLogin()
{
if (Auth::attempt(Binput::only(['email', 'password']))) {
return Redirect::intended('dashboard');
}
Throttle::hit(Request::instance(), 10, 10);
return Redirect::back()->withInput(Binput::except('password'))->with('error', 'Invalid email or password');
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::only('email', 'password');
if (Auth::attempt($input)) {
return Redirect::intended('/profile');
}
return Redirect::back()->withFlashMessage('E-mail Address and/or Password incorrect');
}
示例9: save
public function save($slug, Request $request)
{
if (Auth::check() && Auth::user()->id == Page::slug($slug)->user->id) {
$page = Page::slug($slug);
$page->content = $request->content;
$page->save();
}
return Redirect::intended('/page/' . $slug);
}
示例10: postLogin
public function postLogin()
{
$data['email'] = Input::get('email');
$data['password'] = Input::get('password');
if (Auth::attempt($data, Input::get('remember'))) {
return Redirect::intended('/');
}
return Redirect::to('account/login')->with('errors', 'Datos incorrectos');
}
示例11: doLogin
/**
* Função para login no sistema. Os parâmetros (login e senha) são passados por POST
*
* @return mixed
*/
public function doLogin()
{
try {
Auth::attempt(array('cpf' => Input::get('login'), 'senha' => Input::get('senha')));
return Redirect::intended('/');
} catch (Exception $e) {
return Redirect::to('login')->withErrors($e->getMessage())->withInput();
}
}
示例12: postReauthenticate
/**
* Handle the reauthentication request to the application.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function postReauthenticate(Request $request)
{
$this->validate($request, ['password' => 'required']);
$reauth = new ReauthLimiter($request);
if (!$reauth->attempt($request->password)) {
return Redirect::back()->withErrors(['password' => $this->getFailedLoginMessage()]);
}
return Redirect::intended();
}
示例13: postReauthenticate
/**
* Handle the reauthentication request to the application.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function postReauthenticate(Request $request)
{
$this->validate($request, ['password' => 'required']);
if (!Hash::check($request->password, Auth::user()->getAuthPassword())) {
return Redirect::back()->withErrors(['password' => $this->getFailedLoginMessage()]);
}
$request->session()->set('reauthenticate.life', Carbon::now()->timestamp);
$request->session()->set('reauthenticate.authenticated', true);
return Redirect::intended();
}
示例14: login
public function login()
{
$title = Lang::get('auth::login.title');
if (Request::isMethod('POST')) {
if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'suspended' => 0), Input::has('remember'))) {
return Redirect::intended(Config::get('auth::login.redirect'));
}
return Redirect::back()->with('attempt', false)->withInput();
}
return View::make(Config::get('auth::login.view'), compact('title'));
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$formData = Input::only('email', 'password');
$this->signInForm->validate($formData);
if (!Auth::attempt($formData)) {
Flash::message('We were unable to sign you in. Please check your credentials.');
return Redirect::back()->withInput();
}
Flash::message('Welcome Back!');
return Redirect::intended('statuses');
}