創建postSignIn方法,並希望驗證: 電子郵件,密碼,verifiedFlag 首先是沒有問題創造postSignIn方法,如:Laravel驗證登錄解決方案
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";
}
沒有什麼問題,但我想我需要其他的解決方案,以便驗證不需要登錄(未遂)兩次
我只是意識到我錯誤的放置IF語句._。不管怎樣,謝謝 :) – GandhyOnly 2014-11-02 04:31:11