完成两步验证的逻辑
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
<li class="list-group-header">通用设置</li>
|
||||
<li class="list-group-item"><a href="/account/settings/">个人信息</a></li>
|
||||
<li class="list-group-item active"><a href="/account/settings/avatar/">更换头像</a></li>
|
||||
<li class="list-group-item"><a href="/two_factor_auth/">两步验证</a></li>
|
||||
<li class="list-group-item"><a href="/change_password/">修改密码</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<li class="list-group-header">通用设置</li>
|
||||
<li class="list-group-item"><a href="/account/settings/">个人信息</a></li>
|
||||
<li class="list-group-item"><a href="/account/settings/avatar/">更换头像</a></li>
|
||||
<li class="list-group-item"><a href="/two_factor_auth/">两步验证</a></li>
|
||||
<li class="list-group-item active"><a href="/change_password/">修改密码</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -11,22 +11,21 @@
|
||||
<div class="form-group">
|
||||
<label for="username">用户名</label>
|
||||
<input type="text" class="form-control input-lg" id="username" name="username" maxlength="30"
|
||||
data-error="请填写用户名" placeholder="用户名" autofocus required>
|
||||
data-error="请填写用户名" placeholder="用户名" autofocus required autocomplete="off">
|
||||
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="password">密码</label>
|
||||
<input type="password" class="form-control input-lg" id="password" name="password" maxlength="30"
|
||||
data-error="请填写密码" placeholder="密码" required>
|
||||
data-error="请填写密码" placeholder="密码" required autocomplete="off">
|
||||
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group" id="captcha-area">
|
||||
<label for="captcha">验证码</label> <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="form-group" id="tfa-area">
|
||||
<label for="captcha">两步验证</label>
|
||||
<input type="text" class="form-control input-lg" id="tfa-code" name="tfa-code"
|
||||
placeholder="两步验证验证码" maxlength="6" data-error="请填写两步验证验证码" required autocomplete="off">
|
||||
<div class="help-block with-errors"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<li class="list-group-header">通用设置</li>
|
||||
<li class="list-group-item active"><a href="/account/settings/">个人信息</a></li>
|
||||
<li class="list-group-item"><a href="/account/settings/avatar/">更换头像</a></li>
|
||||
<li class="list-group-item"><a href="/two_factor_auth/">两步验证</a></li>
|
||||
<li class="list-group-item"><a href="/change_password/">修改密码</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
41
template/src/oj/account/two_factor_auth.html
Normal file
41
template/src/oj/account/two_factor_auth.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{% extends "oj_base.html" %}
|
||||
{% block title %}
|
||||
两步验证
|
||||
{% endblock %}
|
||||
{% block body %}
|
||||
<div class="container main">
|
||||
|
||||
<div class="col-lg-2">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-header">通用设置</li>
|
||||
<li class="list-group-item"><a href="/account/settings/">个人信息</a></li>
|
||||
<li class="list-group-item"><a href="/account/settings/avatar/">更换头像</a></li>
|
||||
<li class="list-group-item active"><a href="/two_factor_auth/">两步验证</a></li>
|
||||
<li class="list-group-item"><a href="/change_password/">修改密码</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-8">
|
||||
{% if not request.user.two_factor_auth %}
|
||||
<h3>扫描二维码开启两步验证</h3>
|
||||
<img src="/api/two_factor_auth/" id="tfa-qrcode">
|
||||
|
||||
<div class="form-inline">
|
||||
<div class="form-group">
|
||||
<label for="tfa_code">验证码</label>
|
||||
<input type="text" maxlength="6" class="form-control" id="tfa_code"
|
||||
placeholder="输入 app 上显示的验证码">
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" id="tfa_submit">确定</button>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<div class="alert alert-success" role="alert">两步验证已经开启</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js_block %}
|
||||
<script src="/static/js/app/oj/account/twoFactorAuth.js"></script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user