我对 laravel 中内置的用户身份验证功能有疑问。我让身份验证部分工作,但似乎用户没有存储在会话中。
Route::get('login', function(){
$username = 'stardriver';
$password = '1234';
$creds = array('username' => $username, 'password' => $password);
if(Auth::attempt($creds)){ //I assume that its already logged in when it goes here
return Auth::guest(); //but why does this return 1?
}else{
return 'nope wrong creds'; //if I change the username or password declared above, it goes here
}
});
这是我的管理页面。用户成功通过身份验证后,当我重定向到此页面时,我得到一个无限循环。
Route::get('admin', array('before' => 'auth', 'do' => function(){
return "you are logged in! " . HTML::link('logout', 'logout dude');
}));
你觉得这里有什么问题?