溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Django怎么實現(xiàn)通過郵件找回密碼的功能

發(fā)布時間:2021-09-10 11:36:50 來源:億速云 閱讀:138 作者:chen 欄目:大數(shù)據(jù)

這篇文章主要講解了“Django怎么實現(xiàn)通過郵件找回密碼的功能”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Django怎么實現(xiàn)通過郵件找回密碼的功能”吧!

今天學(xué)習(xí)當(dāng)注冊用戶忘記密碼時,通過發(fā)送郵件進(jìn)行密碼重置的功能,接下來開始:

首先修改django_project\django_project\settings.py,添加郵件相關(guān)的配置:

Django怎么實現(xiàn)通過郵件找回密碼的功能

修改django_project\django_project\urls.py,添加重置密碼url跳轉(zhuǎn)規(guī)則:

Django怎么實現(xiàn)通過郵件找回密碼的功能

在django_project\users\templates\users下新建password_reset.html

Django怎么實現(xiàn)通過郵件找回密碼的功能

在django_project\users\templates\users下新建

password_reset_done.html:

Django怎么實現(xiàn)通過郵件找回密碼的功能

在django_project\users\templates\users下新建

password_reset_confirm.html:

Django怎么實現(xiàn)通過郵件找回密碼的功能

在django_project\users\templates\users下新建

password_reset_complete.html:

Django怎么實現(xiàn)通過郵件找回密碼的功能

修改django_project\users\templates\users\login.html 添加忘記密碼鏈接:

Django怎么實現(xiàn)通過郵件找回密碼的功能

我們在django_project文件夾下運(yùn)行python manage.py runserver 啟動項目,訪問http://127.0.0.1:8000主頁點(diǎn)擊登錄,然后點(diǎn)擊忘記密碼:

Django怎么實現(xiàn)通過郵件找回密碼的功能

Django怎么實現(xiàn)通過郵件找回密碼的功能

點(diǎn)擊密碼重置后會提示郵件已發(fā)送:

Django怎么實現(xiàn)通過郵件找回密碼的功能

進(jìn)入郵箱查看密碼重置的郵件:

Django怎么實現(xiàn)通過郵件找回密碼的功能

點(diǎn)擊郵件中密碼重置的鏈接,輸入新的密碼提交:

Django怎么實現(xiàn)通過郵件找回密碼的功能

Django怎么實現(xiàn)通過郵件找回密碼的功能

重置成功后,點(diǎn)擊現(xiàn)在登錄即可登錄到博客中:

Django怎么實現(xiàn)通過郵件找回密碼的功能

感謝各位的閱讀,以上就是“Django怎么實現(xiàn)通過郵件找回密碼的功能”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對Django怎么實現(xiàn)通過郵件找回密碼的功能這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI