您如何告诉laravel auth::attempt
密码字段以明文形式存储,而不是假设它是散列的?
在guard.php中
public function attempt(array $credentials = array(), $remember = false, $login = true)
{
$this->fireAttemptEvent($credentials, $remember, $login);
$user = $this->provider->retrieveByCredentials($credentials);
// If an implementation of UserInterface was returned, we'll ask the provider
// to validate the user against the given credentials, and if they are in
// fact valid we'll log the users into the application and return true.
if ($user instanceof UserInterface)
{
if ($this->provider->validateCredentials($user, $credentials))
{
if ($login) $this->login($user, $remember);
return true;
}
}
return false;
}
或者更好的是我只有两列,一列作为明文,另一列作为密码安全。
如果我尝试后者,我如何告诉尝试密码列名称是password_secured.
因为我试过这个,得到一个错误Undefined index: password
。
$user = array(
'user_id' => Input::get('username'),
'password_secured' => Input::get('password'),
'checklogin' => 0,
);
if (Auth::attempt($user)) {
return 'login success';
}
问题是我正在移植应用程序,而不是从头开始构建,我真的需要以明文形式存储密码,因为另一个应用程序正在使用数据库(并且它是实时的)并且被编码为以明文形式读取密码。