safesite/groups/templates/groups/login.html

60 lines
2.4 KiB
HTML

{% load static %}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- 上述meta标签*必须*放在最前面,任何其他内容都*必须*跟随其后! -->
<!-- Bootstrap CSS -->
<link href="{% static 'groups/bower_components/bootstrap/dist/css/bootstrap.min.css' %}" rel="stylesheet"/>
<link href="{% static 'groups/login/login.css' %}" rel="stylesheet"/>
<title>登录</title>
</head>
<body>
<div class="container">
<div class="col">
<form class="form-login" action="/groups/login/" method="post">
{% if groups_form.captcha.errors %}
<div class="alert alert-warning">{{ groups_form.captcha.error_messages }}</div>
{% elif message %}
<div class="alert alert-warning">{{ message }}</div>
{% endif %}
{% csrf_token %}
<h3 class="text-center">欢迎登录</h3>
<div class="form-group">
{{ groups_form.username.label_tag }}
{{ groups_form.username}}
</div>
<div class="form-group">
{{ groups_form.password.label_tag }}
{{ groups_form.password }}
</div>
<div class="form-group">
{{ groups_form.captcha.label_tag }}
{{ groups_form.captcha }}
</div>
<div>
<button type="submit" class="btn btn-primary float-right">登录</button>
</div>
</form>
</div>
</div> <!-- /container -->
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="{% static 'groups/bower_components/jquery/dist/jquery.js' %}"></script>
<script src="https://cdn.bootcss.com/popper.js/1.15.0/umd/popper.js"></script>
<script src="{% static 'groups/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
</body>
</html>
<script>
$('.captcha').click(function () {
$.getJSON("/groups/refresh_captcha/", function (result) {
$('.captcha').attr('src', result['image_url']);
$('#id_captcha_0').val(result['key'])
});
});
</script>