Auth :: attempt()在Laravel 5.5中不起作用 [英] Auth::attempt() is not working in Laravel 5.5

查看:140
本文介绍了Auth :: attempt()在Laravel 5.5中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的注册表单正在运行,它将用户存储到db,但是当用户登录时Auth :: attempt()返回false.这是我的登录代码.我在sha1加密中将密码存储在db中.

My registration form is working and it store users to db but when user login then Auth::attempt() return false. Here is my code for login. I store the password in db in sha1 encription.

Route::post('login',function(){
$creds=array(
        'email' => Input::get('email'),
        'password' => sha1(Input::get('password'))
    );
$auth = Auth::attempt($creds);

dd($auth);

推荐答案

我通过将注册用户密码转换为sha1,然后像这样Hash::make(sha1(Input::get('password')));

I solved it by converting the registering user password to sha1 and then to laravel hashing encryption like so Hash::make(sha1(Input::get('password')));

在登录时,我喜欢以下内容

At login time I do like below

Hash::make(sha1(Input::get('password')))

然后$auth = Auth::attempt($creds);有效.

这篇关于Auth :: attempt()在Laravel 5.5中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆