添加找回用户信息功能,修改邮件模板的一些细节

This commit is contained in:
sxw
2015-11-29 11:19:53 +08:00
parent 6c75da1791
commit bd7f1454bf
3 changed files with 88 additions and 13 deletions

View File

@@ -0,0 +1,39 @@
require(["jquery", "bsAlert", "csrfToken", "validator"], function ($, bsAlert, csrfTokenHeader) {
var applied_captcha = false;
$('form').validator().on('submit', function (e) {
if (!e.isDefaultPrevented()) {
var email = $("#email").val();
var captcha = $("#captcha").val();
$.ajax({
beforeSend: csrfTokenHeader,
url: "/api/reset_password/",
data: {email: email, captcha: captcha},
dataType: "json",
method: "post",
success: function (data) {
if (!data.code) {
refresh_captcha();
bsAlert(data.data);
}
else {
refresh_captcha();
bsAlert(data.data);
}
},
error: function(){
bsAlert("额 好像出错了,请刷新页面重试。如还有问题,请填写页面导航栏上的反馈。")
}
});
return false;
}
});
function refresh_captcha(){
$("#captcha-img")[0].src = "/captcha/?" + Math.random();
$("#captcha")[0].value = "";
}
$("#captcha-img").click(function(){
refresh_captcha();
});
});

View File

@@ -1,10 +1,40 @@
<!DOCTYPE html> {% extends "oj_base.html" %}
<html> {% block title %}
<head lang="en"> 找回登录信息
<meta charset="UTF-8"> {% endblock %}
<title></title> {% block body %}
</head> <div class="container main">
<body> <div class="col-md-6 col-md-offset-3">
<h2 class="text-center">找回登录信息</h2><br>
<div>
<p>请输入你注册时使用的邮箱地址,系统将自动向你的邮箱发送一封含有您登录信息的电子邮件,
你可以看到你的用户名并可以选择重新设置登录密码注意为了你的账户安全重置密码链接仅在30分钟内有效</p>
</div>
<br>
<form id="login-form">
<div class="form-group">
<label for="email">注册电子邮件地址</label>
<input type="email" class="form-control input-lg" id="email" name="email" placeholder="邮箱地址"
data-remote="/api/email_check/?reset=true" data-remote-error="该邮箱未被注册!" data-error="请填写正确的邮箱地址"
required>
</body> <div class="help-block with-errors"></div>
</html> </div>
<div class="form-group" id="captcha-area">
<label for="captcha">验证码</label>&nbsp;&nbsp;<img src="/captcha/" id="captcha-img">
<small><p></p></small>
<input type="text" class="form-control input-lg" id="captcha" name="captcha"
placeholder="验证码" maxlength="4" data-error="请填写验证码" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">提交</button>
</div>
</form>
</div>
</div>
{% endblock %}
{% block js_block %}
<script src="/static/js/app/oj/account/resetPassword.js"></script>
{% endblock %}

View File

@@ -8,7 +8,7 @@
<tbody> <tbody>
<tr height="39" style="background-color:#50a5e6;"> <tr height="39" style="background-color:#50a5e6;">
<td style="padding-left:15px;font-family:'微软雅黑','黑体',arial;"> <td style="padding-left:15px;font-family:'微软雅黑','黑体',arial;">
{{ website_name }} 密码找回邮件 {{ website_name }} 登录信息找回
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -32,12 +32,17 @@
</tr> </tr>
<tr height="30"> <tr height="30">
<td style="padding-left:55px;padding-right:55px;font-family:'微软雅黑','黑体',arial;font-size:14px;"> <td style="padding-left:55px;padding-right:55px;font-family:'微软雅黑','黑体',arial;font-size:14px;">
您刚刚在 {{ website_name }} 使用了找回密码功能 您刚刚在 {{ website_name }} 申请了找回登录信息服务
</td> </td>
</tr> </tr>
<tr height="30"> <tr height="30">
<td style="padding-left:55px;padding-right:55px;font-family:'微软雅黑','黑体',arial;font-size:14px;"> <td style="padding-left:55px;padding-right:55px;font-family:'微软雅黑','黑体',arial;font-size:14px;">
请在<span style="color:rgb(255,0,0)">60分钟</span>内点击下面链接设置您的新密码: 您的用户名是:{{ username }}
</td>
</tr>
<tr height="30">
<td style="padding-left:55px;padding-right:55px;font-family:'微软雅黑','黑体',arial;font-size:14px;">
如果您忘记了您的登录密码,请在<span style="color:rgb(255,0,0)">30分钟</span>内点击下面链接设置您的新密码:
</td> </td>
</tr> </tr>
<tr height="60"> <tr height="60">
@@ -63,7 +68,8 @@
</tr> </tr>
<tr height="20"> <tr height="20">
<td style="padding-left:55px;padding-right:55px;font-family:'微软雅黑','黑体',arial;font-size:12px;"> <td style="padding-left:55px;padding-right:55px;font-family:'微软雅黑','黑体',arial;font-size:12px;">
如果没有提出过密码修改申请,请忽略此邮件。有可能是其他用户误填了你的用户名。我们不会对你的帐户进行任何修改。 如果没有提出过申请,请忽略此邮件。有可能是其他用户误填了您的邮件地址。我们不会对你的帐户进行任何修改。
但请<strong>不要向任何人泄漏这封邮件中的内容</strong>,我们的工作人员不会以任何理由向您索要该邮件涉及到的任何信息。
</td> </td>
</tr> </tr>
<tr height="20"> <tr height="20">