ログインや投稿の際など、ページが変更されるたびに、最近、今日、そして昨日私のプロジェクトにリダイレクトステートメントが表示されています。Laravelログインが停止し、新しいリダイレクトステートメントが表示され始めました
私はartisan migrate:refresh --seedを使用してデータベースをリフレッシュすることにしました。ログインすることもできません。 /メンバーへのリダイレクトメッセージを返してから/ログインする
誰もがこれを前にしていますか?
私の認証コード:
namespace App\Http\Controllers\Auth;
use App\User;
use Socialite;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
/**
* Where to redirect users after login/registration.
*
* @var string
*/
protected $redirectTo = '/members';
protected $socialite;
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct(Socialite $socialite)
{
$this->middleware('guest', ['except' => 'logout']);
$this->socialite = $socialite;
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|max:255',
'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
// populate the md5 attribute
$user->md5 = md5($user->id);
$user->save();
return $user;
}
public function getSocialAuth($provider=null)
{
if(!config("services.$provider")) abort('404'); //just to handle providers that doesn't exist
return $this->socialite->with($provider)->redirect();
}
public function getSocialAuthCallback($provider=null)
{
if($user = $this->socialite->with($provider)->user()){
dd($user);
}else{
return 'something went wrong';
}
}
}
注:私は単に一時的にユーザーのためのユニークな値としてMD5を使用しています。
更新: クッキーをクリアした後、今すぐログインしようとすると、私はリダイレクトさえできません。私はちょうど以下のエラーメッセージを受け取ります。 VerifyCsrfToken.php線67で
TokenMismatchException:
更新:
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Login</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
{!! csrf_field() !!}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
@if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input type="password" class="form-control" name="password">
@if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
@endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember"> Remember Me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
<i class="fa fa-btn fa-sign-in"></i>Login
</button>
<a class="btn btn-link" href="{{ url('/password/reset') }}">Forgot Your Password?</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
アップデート:私は、データベースを使用するようにセッションの設定に変更した、とエラーが解決しません。
アプリケーション・キーを変更しましたか?ユーザーシードデータはランダムであるか、手動で指定したものですか?あなたの質問はかなり幅広く、コードを追加していないので、問題の発生場所を推測することは本当に難しいです。ログインプロセスに関連するコードを少なくとも投稿してください。 – Bogdan
いいえ、私はlaravelコードに関しては何も変更していません。私はこの問題に関連するものが何かを知りませんでした。シードデータは静的です。どんな授業を投稿したいですか? –
私はあなたがログインオプションとしてSocialiteを使っているのを見ています(少なくともあなたにはコードがあります)。これ以上社会的なログインや定期的なユーザー/パスのログインはできません。 – Bogdan