Laravel从外部系统登录

时间:2017-08-28 16:35:12

标签: laravel laravel-5

我正在外部系统中开发一个带有Laravel 5的模块,外部系统在另一个数据库中有自己的登录和数据,然后我必须在我的Laravel模块中实现权限,所以我不得不在中间配置一个中间件路线,现在我得到2个登录屏幕,我只需要使用外部系统登录Laravel,我在laravel的用户表中创建了相同的凭据,所以我想检查外部用户名对laravel用户名,获取密码并自动登录进入laravel    在哪里这样做是我面临的主要问题。

enter image description here

我需要这个屏幕才能自动登录 enter image description here

路由中间件:

$client = new Client(); //GuzzleHttp\Client
$result = $client->get($url);
$body = (string)$result->getBody();  

我使用guzzle

从外部系统获取用户名
 $resp = User::select('username','password')->where('username',trim($body))->first();
    $password = (bcrypt($resp->password));

    if (Auth::attempt(['username' =>$resp->username, 'password' => $password])){
    dd('Hello world');
    return redirect()->intended('dashboard');
       /* ->route('admin/dashboard')
        ->with('Welcome! Your account has been successfully created!'); */
    }  

  if (Auth::guest()) {

      return redirect(url(config('backpack.base.route_prefix').'/login'));
    }

这就是我在角色中间件中所尝试的:(猜测它失败了,密码哈希,我总是得到登录屏幕)

<tr t-foreach="p.account_move_line" t-as="j">
    <span t-esc="j.journal_id"/>
</tr>

0 个答案:

没有答案
相关问题