shoptima的项目 安装好了但是登录不进去
https://learnku.com/articles/5963/toggle-laravel-login-default-bcrypt-encryption-validation
跟着这篇文章先了解了laravel login default bcrypt 加密验证的流程
然后在
shoptima_crm/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php
public function validateCredentials
在check之前添加如下代码
$pwd = 'secret'; // echo $hash = password_hash($pwd, PASSWORD_BCRYPT);exit; $hash = '$2y$10$sCP.2BFmk74IIJ6ftVT4.uN4BjH092LpvgcFAG7FtSOvT4VmJ0guW'; if (password_verify($pwd,$hash)) { echo "密码正确"; } else { echo "密码错误"; } exit;
然后把password_hash算出的密码 保存到数据库里就可以了
password_hash每次加密过的结果都是不同的
只有通过password_verify来验证
—————————–
可以使用artisan来做:
php artisan tinker $u =App\User::find(1) $u->password=bcrypt('newpassword') $u->save()
—————————–
另外一种方式:
Set mail driver as "log" ( .env file )
click forgot password
get password reset link(mail content) in laravel.log
paste it in browser and reset password.