Php 拉威尔5.2韩元';t持久化手动登录身份验证::尝试
我正在尝试通过电子邮件url对用户进行身份验证。在我的Php 拉威尔5.2韩元';t持久化手动登录身份验证::尝试,php,laravel,authentication,Php,Laravel,Authentication,我正在尝试通过电子邮件url对用户进行身份验证。在我的Auth模型中: public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->guest()) { if ($request->ajax()) { return response('Unauthorized.', 401); } else {
Auth
模型中:
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
if(isset($_GET['newuser'])) {
$data = [
'email' => $_GET['newuser'],
'token' => $_GET['token']
];
return redirect()->action('UserActivateController@newUser', $data);
}
return redirect()->guest('login');
}
}
return $next($request);
}
然后将其转发到公共视图:
public function newUser()
{
if (Auth::attempt(['email' => $_GET['email'], 'password' => $_GET['token']])) {
Session::save();
return redirect('/');
}
}
Auth::trunt
函数通过,但当我尝试重定向用户时,会话丢失,它们被转发回登录视图
编辑:应该注意的是,我使用的是内置的auth,除此修改外,一切正常