ng-tracker/src/main/resources/templates/reset.html
2018-05-04 17:08:20 +04:00

77 lines
3.2 KiB
HTML

<!DOCTYPE html>
<html lang="en"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorator="default">
<head>
</head>
<body>
<nav layout:fragment="navbar">
<div class="navbar-header">
<a class="navbar-brand" href="/"><span class="ui-menuitem-text"><i
class="fa fa-plane fa-4" aria-hidden="true"></i> Balance</span></a>
</div>
</nav>
<div class="container" layout:fragment="content">
<form id="reset-form" method="post" class="margined-top-10">
<fieldset>
<div class="form-group">
<input type="password" name="password" id="password1" class="form-control"
placeholder="Пароль" required="true" minlength="6" maxlength="50" autofocus="autofocus"/>
</div>
<div class="form-group">
<input type="password" name="passwordConfirm" id="password2" class="form-control"
placeholder="Пароль (подтверждение)" required="true" minlength="6" maxlength="50"/>
</div>
<button type="submit" class="btn btn-success btn-block">Обновить пароль</button>
<div class="form-group">
<small class="form-text text-muted">
<a href="/login">Вернуться к странице входа</a>
</small>
</div>
</fieldset>
</form>
<div id="back" class="margined-top-10" style="display: none">
<a href="/login" class="btn btn-success btn-block" role="button">Вернуться к странице входа</a>
</div>
</div>
<th:block layout:fragment="data-scripts">
<script type="text/javascript">
/*<![CDATA[*/
$(document).ready(function () {
$("#reset-form").submit(function () {
var key = getUrlVar("key");
if (isEmpty(key)) {
showFeedbackMessage("Ключ активации не задан", MessageTypesEnum.DANGER);
return false;
}
var password = $("#password1").val();
var passwordConfirm = $("#password2").val();
if (isEmpty(password) || isEmpty(passwordConfirm)) {
showFeedbackMessage("Пароль не задан", MessageTypesEnum.DANGER);
return false;
}
var postData = {
password: password,
passwordConfirm: passwordConfirm
};
postToRest(urlUsersPasswordReset + "?key=" + key, JSON.stringify(postData),
function () {
showFeedbackMessage("Пароль пользователя успешно обновлен");
},
function () {
$("#password1").val("");
$("#password2").val("");
$("#reset-form").hide();
$("#back").show();
}
);
return false;
});
});
/*]]>*/
</script>
</th:block>
</body>
</html>