我将创建postSignIn方法并进行验证: 电子邮件,密码,验证标志 首先,创建postSignIn方法时没有任何问题,例如:
public function postSignIn(){
if(Auth::attempt(array('email' => Input::get('email'),'password' => Input::get('password'),'verifiedFlag'=>1))){
return Redirect::route('home-view');
}
else{
return "Email/Password wrong or Your Account not verified by Admin";
}
}
现在我尝试通过分别针对以下两种情况提供警报,使其更加用户友好:
- 账户未验证
- 电子邮件/密码错误
现在我尝试将其改为以下形式:
if(Auth::attempt(array('nim' => Input::get('nim'),'password' => Input::get('password')))){
Auth::logout();
if(Auth::attempt(array('nim' => Input::get('nim'),'password' => Input::get('password'),'verified' => 1))){
return Redirect::route('home-view');
}
else{
return "Your Account not verfied. Please wait until admin verified your account or contact your admin";
}
}
else{
return "NIM/Password wrong";
}
目前没有问题,但我认为需要其他解决方案,这样就不需要进行两次身份验证登录。