簡體   English   中英

Laravel密碼重置不起作用

[英]Laravel Password reset not working

我有一個情況,lavavel密碼身份驗證似乎無法進行密碼重置。 新用戶的新密碼可以正常工作。

 $email = $request['email'];
  //$pwmail = (string)str_random(10);
  $pwmail = (random_str(4));
  //$pwmail = '1234';
  $password = \Hash::make($pwmail);

  $userscon2 = \DB::table('users')->where('email',$email )->update(['password' => $password]);

我已經打印出散列,並將它們與數據庫中的內容進行比較,並且它們匹配。 下面是我的登錄控制器的一部分

 if (Auth::attempt(['email' => $request['email'], 'password' => $request['password']])) {
       return redirect()->route('dashboard');
    } else {
    return redirect()->back();
    }

我也碰巧也嘗試了bcrypt。

我認為您應該在嘗試登錄之前執行Hash::check($new_password, $db_password)來檢查當前密碼與新密碼。 這個答案可能會給您一個想法。 另外,請參閱版本5.1 哈希文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM