久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Laravel Auth - 使用 md5 而不是集成的 Hash::make()

Laravel Auth - use md5 instead of the integrated Hash::make()(Laravel Auth - 使用 md5 而不是集成的 Hash::make())
本文介紹了Laravel Auth - 使用 md5 而不是集成的 Hash::make()的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

所以,我要為我的網站切換到 Laravel.我的舊網站目前擁有大約 500 個用戶.每個用戶都有一個附加到他們的 md5 哈希,作為密碼(廢話^^).

So, I'm switching over to laravel for my site. My old site currently holds around 500 users. Each user has a md5 hash attached to them, as the password (duh ^^).

當我切換到 Laravel 時,我希望使用 Auth::attempt不幸的是,它使用自己的方法來散列密碼字符串.我不希望我的所有用戶都更改他們的密碼,因為我要切換到 Laravel,是否可以讓 Auth 類使用 md5,這樣我的用戶就不必切換密碼了?:)

As I'm switching over to laravel, I wish to use the Auth::attempt unfortunately it uses its own method to hash password strings. I don't want all my users to change their password, because I'm switching to laravel, is it possible to make the Auth class use md5 instead, so my users don't have to switch password? :)

如果是,有人可以告訴我怎么做嗎?

If yes, can someone show me how?

推薦答案

MD5 已經過時了.我建議你不要試圖保留它.相反,當用戶第一次登錄并且 Auth::attempt 失敗時,您應該嘗試將他們的密碼與數據庫作為 MD5 進行比較

MD5 is horribly outdated. I recommend that you don't try to keep it. Instead, when a user first logs in, and Auth::attempt fails, you should then try to compare their password to the database as MD5

$user = User::where('username', '=', Input::get('username'))->first();

if(isset($user)) {
    if($user->password == md5(Input::get('password'))) { // If their password is still MD5
        $user->password = Hash::make(Input::get('password')); // Convert to new format
        $user->save();
        Auth::login(Input::get('username'));
    }
}

這篇關于Laravel Auth - 使用 md5 而不是集成的 Hash::make()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Laravel Eloquent Union query(Laravel Eloquent Union 查詢)
Overwrite laravel 5 helper function(覆蓋 Laravel 5 輔助函數)
laravel querybuilder how to use like in wherein function(laravel querybuilder 如何在 where 函數中使用 like)
The Response content must be a string or object implementing __toString(), quot;booleanquot; given after move to psql(響應內容必須是實現 __toString()、“boolean和“boolean的字符串或對象.移動到 psql 后給出) - IT屋-程
Roles with laravel 5, how to allow only admin access to some root(Laravel 5 的角色,如何只允許管理員訪問某些根)
How to set and get Cookie in laravel(如何在 Laravel 中設置和獲取 Cookie)
主站蜘蛛池模板: 久久国产亚洲 | 色综合99| 国产精品久久久久aaaa九色 | 午夜久久av | 精品日韩一区 | 粉嫩国产精品一区二区在线观看 | 亚洲成人网在线 | 国产在线不卡 | 91久久| 97超碰人人 | 亚洲精品专区 | 久久精品亚洲精品 | 中文字幕在线免费观看 | 国产一区二区自拍 | 国产第一页在线播放 | 久久久久久久久国产精品 | 最新中文在线视频 | 日韩在线视频免费观看 | 日韩精品1区2区 | 亚洲h视频| 国产免费一区二区 | 成人免费观看男女羞羞视频 | 精品国产高清一区二区三区 | 亚洲网站在线播放 | 国产精品日本一区二区在线播放 | 中文欧美日韩 | 久久一区二区视频 | 精久久久 | 精品国产一区二区三区观看不卡 | 一区二区国产精品 | 欧美一区二区三区 | 99re6在线视频 | 成人欧美一区二区三区白人 | 免费播放一级片 | 国产羞羞视频在线观看 | 日韩视频一区在线观看 | 日本一区视频在线观看 | 美女一区| 欧美一区二区在线播放 | 免费看色 | 中文成人在线 |