使用 Djoser 实现忘记密码功能

Implement forgot password functionality using Djoser

我是 Django 框架的新手,现在遇到忘记密码功能的问题。我已阅读有关该功能的文档,但有些内容不清楚。 我需要有人可以更详细地向我展示前端和后端的步骤。

reset() {
    var self = this;
    axios
        .post(this.$apiUrl + "password/reset/", {
            email: self.email
        })
        .then(response => {
            console.log(response);
        })
        .catch(error => {
            console.log(error);
        });
}

请参考documentation on this feature

基本上,首先您需要像您所讨论的那样调用重置端点。接下来,用户应该会收到一封电子邮件,将他们指向 PASSWORD_RESET_CONFIRM_URL 设置中给出的 url。在 url 上,您的前端应用程序应在 API 上调用确认 url(请参阅文档)。