fix login

This commit is contained in:
Anton Romanov 2019-03-06 16:40:33 +04:00
parent febdb0b027
commit 42fdb51337
2 changed files with 29 additions and 102 deletions

View File

@ -57,7 +57,7 @@
<a class="nav-link js-scroll-trigger" target="_blank" href="https://kias.rfbr.ru/">КИАС РФФИ</a> <a class="nav-link js-scroll-trigger" target="_blank" href="https://kias.rfbr.ru/">КИАС РФФИ</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link js-scroll-trigger" href="#logout">Выход</a> <a class="nav-link js-scroll-trigger" href="/logout">Выход</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" <html lang="en"
xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml">
<head> <head>
</head> </head>
<body> <body>
@ -11,13 +11,11 @@
class="fa fa-plane fa-4" aria-hidden="true"></i> Balance</span></a> class="fa fa-plane fa-4" aria-hidden="true"></i> Balance</span></a>
</div> </div>
</nav> </nav>
<div class="container" layout:fragment="content"> <div layout:fragment="content">
<ul class="nav nav-tabs"> <section class="bg-light" id="portfolio">
<li class="active"><a href="#signin">Вход в систему</a></li> <div class="container">
<li><a href="#register">Регистрация</a></li> <div class="row justify-content-md-center">
</ul> <div class="col-lg-6">
<div class="tab-content">
<div id="signin" class="tab-pane active">
<form th:action="@{/login}" method="post" class="margined-top-10"> <form th:action="@{/login}" method="post" class="margined-top-10">
<fieldset> <fieldset>
<div class="form-group"> <div class="form-group">
@ -37,80 +35,9 @@
</fieldset> </fieldset>
</form> </form>
</div> </div>
<div id="register" class="tab-pane">
<form id="register-form" class="margined-top-10">
<fieldset>
<div class="form-group">
<input type="text" name="login" id="login" class="form-control"
placeholder="Логин" required="true" autofocus="true"
minlength="4" maxlength="50"/>
</div>
<div class="form-group">
<input type="text" name="firstName" id="firstName" class="form-control"
placeholder="Имя" required="true" autofocus="true"
minlength="2" maxlength="50"/>
</div>
<div class="form-group">
<input type="text" name="lastName" id="lastName" class="form-control"
placeholder="Фамилия" required="true" autofocus="true"
minlength="2" maxlength="50"/>
</div>
<div class="form-group">
<input type="text" name="email" id="email" class="form-control"
placeholder="E-Mail" required="true" autofocus="true"
minlength="5" maxlength="100"/>
</div>
<div class="form-group">
<input type="password" name="password" id="password1" class="form-control"
placeholder="Пароль" required="true" maxlength="50"/>
</div>
<div class="form-group">
<input type="password" name="passwordConfirm" id="password2" class="form-control"
placeholder="Пароль (подтверждение)" required="true" maxlength="50"/>
</div>
<button type="submit" class="btn btn-info btn-block">Создать запись</button>
</fieldset>
</form>
</div> </div>
</div> </div>
</section>
</div> </div>
<th:block layout:fragment="data-scripts">
<script type="text/javascript">
/*<![CDATA[*/
$(document).ready(function () {
if (isUrlVarExists('error')) {
showFeedbackMessage('Ошибка входа в систему', 'danger');
}
if (isUrlVarExists('logout')) {
showFeedbackMessage('Выход из системы произведен');
}
registerFormToJson = function () {
var formData = {};
$("#register-form").find(":input").not(":button").each(function () {
if ($(this).val() == null || $(this).val() === "") {
return true;
}
formData[$(this).attr("name")] = $(this).val();
});
return JSON.stringify(formData);
};
registerUser = function () {
postToRest(urlUsersRegister, registerFormToJson(), function (data) {
showFeedbackMessage("Пользователь успешно создан");
$("#register-form").find(":input").not(":button").val("");
});
};
$("#register-form").submit(function () {
registerUser();
return false;
});
});
/*]]>*/
</script>
</th:block>
<th:block layout:fragment="scripts">
<script src="/js/hashable-tabs.js"></script>
</th:block>
</body> </body>
</html> </html>