0

我想禁用laravel密码bcrypt,当我尝试登录,在这样如何禁用laravel 5.2密码bcrypt

Auth::guard('client')->attempt(
'id' => $request['id'], 
'password' => $request['password']) 

但它似乎比我想象的更难治,我知道我不应该做到这一点,但我暂时需要这样工作,但laravel迫使我使用加密密码。我需要能够在我的数据库上使用普通密码。

我一直在互联网上搜索,但我找不到解决方案。

+0

哦否:未来还有另一种安全漏洞。 – zaph

+0

不要在数据库中使用纯文本密码。 –

回答

0

可以扩展照亮\身​​份验证\ EloquentUserProvider,即:

<?php 

namespace App\Services\Auth; 

use Illuminate\Auth\EloquentUserProvider as BaseUserProvider; 
use Illuminate\Contracts\Auth\Authenticatable as UserContract; 

class UserProvider extends BaseUserProvider { 
    /** 
    * Create a new database user provider. 
    * 
    * @param string $model 
    * 
    * @return void 
    */ 
    public function __construct($model) 
    { 
     $this->model = $model; 
    } 

    /** 
    * Validate a user against the given credentials. 
    * 
    * @param \Illuminate\Contracts\Auth\Authenticatable $user 
    * @param array          $credentials 
    * 
    * @return bool 
    */ 
    public function validateCredentials(UserContract $user, array $credentials) 
    { 
     $plain = $credentials['password']; 

     // $matches = some method of matching $plain with $user->getAuthPassword(); 

     return $matches; 
    } 
} 

然后在国际奥委会服务提供商像这样注册的:

<?php // ... 

/** 
* Register the service provider. 
* 
* @return void 
*/ 
public function register() 
{ 
    // ... 

    $this->app['auth']->extend(
     'legacy', 
     function() { 
      return new \Illuminate\Auth\Guard(
       new \App\Services\Auth\UserProvider(
        $this->app['config']['auth.model'] 
       ), 
       $this->app['session.store'] 
      ); 
     } 
    ); 

    // ... 
} 

然后设置当前的驱动程序遗留在配置/ auth.php。

PS:您可能希望在提供商中包含这些类,

+0

延期是什么意思?什么类?,什么是LC? – Saucyloco