为了账号安全,请及时绑定邮箱和手机立即绑定

如何解密密码以登录laravel?

如何解密密码以登录laravel?

PHP
呼唤远方 2021-06-29 13:55:07
更改密码时,我正在使用此功能public function passwordChange(Request $request, $userId)    {        $user = User::find($userId);        $user->password = Crypt::encrypt(Input::get('password'));        $user->save();        return redirect('my-profile');    }所以在我的 mongoDb 数据库密码以加密形式插入,所以每当我必须登录系统时,我如何将我的密码与数据库密码进行比较 public function authenticate(Request $request)    {        $rules = array(            'company_email' => 'required|email|exists:users,company_email',            'password' => 'required|string|max:20|min:4',        );        $validator = Validator::make(Input::all(), $rules);        if ($validator->fails())         {            return view('pages.login')->with('v_errors', $validator->errors()->messages());        }         else         {            //get email and query            $authenticateMe = $request->only('company_email', 'password');            $user = User::where($authenticateMe)->first();            if (empty($user))             {                return view('pages.login')->with('not_exists', 'true');            }            //session set            // Session::put('key', $user->username, $user->file);            Session::put('key', ['username' => $user->username, 'email' => $user->company_email, 'userId' => $user->id, 'profilePicture' => $user->file]);            return redirect('my-profile');        }    }我没有使用 php artisan make:auth 会有人帮忙吗??
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 222 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信