我无法让身份验证与 laravel 4 一起使用。当用户在表单中输入他们的电子邮件和密码时,这是我的全部登录功能。
public function getSignin() {
$return_arr = array();
$email = Input::get('email');
$password = Input::get('password');
$validation = Validator::make(
array(
'Email' => $email,
'Password' => $password
), array(
'Email' => 'required|Email',
'Password' => 'required'
)
);
if ($validation->passes()) {
$pass = base64_encode($password);
$details = array ('email' => $email, 'password' => $pass);
if (Auth::attempt($details)) {
$return_arr['frm_check'] = 'success';
$return_arr['msg'] = 'logged in';
} else {
$return_arr['frm_check'] = 'error';
$return_arr['msg'] = 'log in failed';
}
} else {
$errors = $validation->messages();
$return_arr['frm_check'] = 'error';
$return_arr['msg'] = $errors->first();
}
echo json_encode($return_arr);
$this->layout = null;
return;
}
即使电子邮件和密码在数据库中的同一行,它仍然返回登录失败,想知道是否有人可以对这种情况有所了解?
如果我错过了任何其他重要细节,请告诉我,我会立即发布。提前致谢。