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;
}
1 つはプレーンテキストで、もう 1 つは password_secured です。
後者を試した場合、パスワード列名がpassword_secured.
Cuz 私はこれを試しましたが、エラーが発生しましUndefined index: password
た。
$user = array(
'user_id' => Input::get('username'),
'password_secured' => Input::get('password'),
'checklogin' => 0,
);
if (Auth::attempt($user)) {
return 'login success';
}
問題は、ゼロから構築するのではなく、アプリケーションを移植していることです。別のアプリケーションがDBを使用しており(ライブであり)、プレーンテキストでパスワードを読み取るようにコーディングされているため、パスワードをプレーンテキストで保存する必要があります。