我正在使用AngularJS v1.5.6开发一个网页 . 此页面有其他形式 . 我想在此页面中添加“重置密码”表单 .
理想情况下,表单可能看起来像这样:
<div ng-app="app" ng-controller="Ctrl">
<form method="post" name="resetPWForm" ng-submit="resetPW(resetPW.email)">
<small>{{ resetPW.msg }}</small>
<input
placeholder="Email"
type="email
ng-model="resetPW.email">
</form>
</div>
我希望 resetPW()
能像这样:
$scope.resetPW = function(email){
$http.post(
{"email":email},
"path/for/resetting/email")
}.then(function(response){
if(response.success==false){
$scope.resetPW.msg = "There was a problem. Please try again.";
return;
}
alert("Success! Check your email for a link to finish resetting your password.");
});
我已经看到这个Django密码重置为教程:https://simpleisbetterthancomplex.com/tutorial/2016/09/19/how-to-create-password-reset-view.html . 但是我将它应用到我的情况中 .
我的问题是我如何设置 urls.py
和 views.py
来处理这个问题?