|
2 | 2 |
|
3 | 3 | {% load bootstrap4 %}
|
4 | 4 |
|
| 5 | + |
| 6 | +{% block title %}Login{% endblock %} |
| 7 | + |
| 8 | + |
| 9 | +{% block css %} |
| 10 | +<style> |
| 11 | +@media screen and (min-width: 992px) { |
| 12 | + html, |
| 13 | + body { |
| 14 | + height: 100%; |
| 15 | + position: relative; |
| 16 | + } |
| 17 | + div.container-fluid { |
| 18 | + background-color: #e9ecef; |
| 19 | + padding: 4rem 2rem; |
| 20 | + min-height: calc(100vh - 56px); |
| 21 | + overflow: hidden; |
| 22 | + display: block; |
| 23 | + position: relative; |
| 24 | + padding-bottom: 100px; /* height of your footer */ |
| 25 | + } |
| 26 | + div.container-fluid div.col-md-6 { |
| 27 | + background-color:#ffffff; |
| 28 | + margin:0 auto; |
| 29 | + max-width: 600px; |
| 30 | + padding: 2rem 2rem; |
| 31 | + } |
| 32 | + footer { |
| 33 | + position: absolute; |
| 34 | + bottom: 0; |
| 35 | + width: 100%; |
| 36 | + } |
| 37 | +} |
| 38 | +</style> |
| 39 | +{% endblock %} |
| 40 | + |
| 41 | + |
5 | 42 | {% block content %}
|
6 |
| - <div class="jumbotron"> |
| 43 | + <div class="container-fluid"> |
7 | 44 | <div class="row justify-content-md-center">
|
8 |
| - <div class="col-md-6"> |
9 |
| - {% if request.GET.status and request.GET.status == 'success' %} |
10 |
| - <div class="alert alert-info alert-dismissable alert-link"> |
| 45 | + <div class="col-md-6"> |
| 46 | + |
| 47 | + {% if request.GET.status and request.GET.status == 'success' %} |
| 48 | + <div class="alert alert-info alert-link alert-dismissable"> |
11 | 49 | <button class="close" type="button" data-dismiss="alert" aria-hidden="true">×</button>
|
12 | 50 | Your account was successfully created!
|
13 | 51 | </div>
|
14 |
| - {% endif %} |
15 |
| - <form action="." method="POST"> |
16 |
| - {% csrf_token %} |
17 |
| - {% bootstrap_form form %} |
18 |
| - <p class="small"><a href="/password_reset/">Forgot your password?</a></p> |
19 |
| - {% buttons %} |
20 |
| - <button type="submit" class="btn btn-primary"> |
21 |
| - Submit |
22 |
| - </button> |
23 |
| - {% endbuttons %} |
24 |
| - </form> |
| 52 | + {% endif %} |
| 53 | + |
| 54 | + {% if request.user.is_authenticated %} |
| 55 | + <div class="alert alert-warning alert-link"> |
| 56 | + You already logged in. Please <a href="{% url 'logout' %}?next={{ request.get_full_path|urlencode }}">logout</a> first. |
| 57 | + </div> |
| 58 | + {% else %} |
| 59 | + <form action="." method="POST"> |
| 60 | + {% csrf_token %} |
| 61 | + {% bootstrap_form form %} |
| 62 | + <p class="small text-right"><a href="{% url 'password_reset' %}">Forgot your password?</a></p> |
| 63 | + |
| 64 | + <div> |
| 65 | + <button type="submit" class="btn btn-primary btn-block"> |
| 66 | + Login |
| 67 | + </button> |
| 68 | + </div> |
| 69 | + </form> |
| 70 | + {% endif %} |
| 71 | + </div> |
25 | 72 | </div>
|
26 | 73 | </div>
|
27 |
| - </div> |
28 | 74 | {% endblock %}
|
0 commit comments