This commit is contained in:
Egor Matveev
2022-05-10 23:03:04 +03:00
parent 1a6bf13b96
commit d4d7474d9a
13 changed files with 384 additions and 47 deletions

View File

@@ -2,41 +2,6 @@
{% 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>
@@ -44,18 +9,21 @@
<table><tr><td><img style="height: 80px; width: 80px;" src="/static/assets/img/brand/dark.svg" /></td><td><h1>Sprint</h1></td></tr></table>
</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>
<form method="POST">
<p id="message" style="color: red;"></p>
{% csrf_token %}
<input type="text" class="form" name="username" id="username" placeholder="Имя пользователя или email"><br>
<input type="password" class="form" name="password" placeholder="пароль"><br>
<input type="hidden" id="state" value="code">
<button type="submit" id="enter" class="sub btn btn-dark form">Вход</button>
</form>
</div>
<div>
<a href="https://t.me/sprint_notifications_bot" target="_blank" class="sub btn btn-dark form">Регистрация</a>
<a href="/register" class="sub btn btn-dark form">Регистрация</a>
</div><br>
или войти с помощью<br><br>
<a href="https://oauth.vk.com/authorize?client_id=8123759&redirect_uri=http://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>
<a href="https://oauth.vk.com/authorize?client_id=8123759&redirect_uri=http://192.168.0.146:8000/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>
<a href="/telegram_enter"><img style="width: 40px; height: 40px; margin-left: 10px;" src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Telegram_logo.svg/640px-Telegram_logo.svg.png"></a>
</center>
</div>
{% endblock %}