63 lines
2.8 KiB
HTML
63 lines
2.8 KiB
HTML
{% extends 'base.html' %}
|
||
|
||
{% block title %}Вход{% endblock %}
|
||
|
||
{% block scripts %}
|
||
function send_code() {
|
||
const p = document.getElementById('message');
|
||
if (document.getElementById('state').value == 'code') {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: '/send_code',
|
||
data: {"username": document.getElementById('username').value, "csrfmiddlewaretoken": document.getElementsByName('csrfmiddlewaretoken')[0].value, "action": "create"},
|
||
success: function(data) {
|
||
if (data['success']) {
|
||
document.getElementById('code').hidden = false;
|
||
document.getElementById('enter').firstChild.data = "Вход";
|
||
document.getElementById('state').value = "verify";
|
||
p.innerHTML = '';
|
||
} else {
|
||
p.innerHTML = data['message'];
|
||
}
|
||
}});
|
||
} else {
|
||
$.ajax({
|
||
type: "POST",
|
||
url: '/send_code',
|
||
data: {"username": document.getElementById('username').value, "code": document.getElementById('code').value, "csrfmiddlewaretoken": document.getElementsByName('csrfmiddlewaretoken')[0].value, "action": "check"},
|
||
success: function(data) {
|
||
if (data['success']) {
|
||
window.location.href = '/';
|
||
} else {
|
||
p.innerHTML = data['message'];
|
||
}
|
||
},
|
||
});
|
||
}
|
||
}
|
||
{% endblock %}
|
||
|
||
{% block body %}
|
||
<div class="center">
|
||
<center>
|
||
<div>
|
||
<h1>
|
||
<i class="fa fa-random"></i> Sprint
|
||
</h1>
|
||
</div>
|
||
<div>
|
||
<p id="message" style="color: red;"></p>
|
||
{% csrf_token %}
|
||
<input type="text" class="form" name="username" id="username" placeholder="username"><br>
|
||
<input type="password" class="form" name="code" id="code" placeholder="code" hidden><br>
|
||
<input type="hidden" id="state" value="code">
|
||
<button type="button" onclick="send_code()" id="enter" class="sub btn btn-dark form">Отправить код</button>
|
||
</div>
|
||
<div>
|
||
<a href="https://t.me/sprint_notifications_bot" target="_blank" class="sub btn btn-dark form">Регистрация</a>
|
||
</div><br>
|
||
или войти с помощью<br><br>
|
||
<a href="https://oauth.vk.com/authorize?client_id=8123759&redirect_uri=http://demo.dev.sprinthub.ru/vk_auth&display=page&response_type=token&v=5.59"><img style="width: 40px; height: 40px;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/VK_Compact_Logo_%282021-present%29.svg/1200px-VK_Compact_Logo_%282021-present%29.svg.png"></a>
|
||
</center>
|
||
</div>
|
||
{% endblock %} |