This commit is contained in:
Artem.Arefev 2019-05-24 01:52:50 +04:00
parent 661da17f73
commit 8bb9e3a844
2 changed files with 25 additions and 25 deletions

View File

@ -1,7 +1,7 @@
function changePassword() {
oldPassword = document.getElementById("oldPassword").value
password = document.getElementById("password").value
confirmPassword = document.getElementById("confirmPassword").value
oldPassword = $("#oldPassword").val()
password = $("#password").val()
confirmPassword = $("#confirmPassword").val()
if ([oldPassword.length, password.length, confirmPassword.length].includes(0)) {
showFeedbackMessage("Заполните все поля", MessageTypesEnum.WARNING);
@ -23,7 +23,7 @@ function changePassword() {
}),
method: "POST",
success: function() {
document.getElementById("closeModalPassword").click();
$("#closeModalPassword").click();
showFeedbackMessage("Пароль был обновлен", MessageTypesEnum.SUCCESS)
},
@ -34,7 +34,7 @@ function changePassword() {
}
function inviteUser() {
email = document.getElementById("email").value;
email = $("#email").val();
if (!isEmailValid(email)) {
showFeedbackMessage("Некорректный почтовый ящик", MessageTypesEnum.WARNING);
return;
@ -45,7 +45,7 @@ function inviteUser() {
contentType: "application/json; charset=utf-8",
method: "POST",
success: function() {
document.getElementById("closeModalInvite").click();
$("#closeModalInvite").click();
showFeedbackMessage("Пользователь был успешно приглашен", MessageTypesEnum.SUCCESS)
},
error: function(errorData) {
@ -55,13 +55,13 @@ function inviteUser() {
}
function requestResetPassword() {
email = document.getElementById("emailReset").value
email = $("#emailReset").val()
if (!isEmailValid(email)) {
showFeedbackMessage("Некорректный почтовый ящик", MessageTypesEnum.WARNING);
return;
}
document.getElementById("dvloader").hidden = false;
$("#dvloader").show();
$.ajax({
url:"/api/1.0/users/password-reset-request?email=" + email,
@ -69,27 +69,27 @@ function requestResetPassword() {
method: "POST",
success: function() {
showFeedbackMessage("Проверочный код был отправлен на указанный почтовый ящик", MessageTypesEnum.SUCCESS)
document.getElementById("passwordNew").hidden = false
document.getElementById("passwordConfirm").hidden = false
document.getElementById("btnReset").hidden = false
document.getElementById("resetKey").hidden = false
document.getElementById("emailReset").hidden = true
document.getElementById("btnSend").hidden = true
document.getElementById("dvloader").hidden = true;
$("#passwordNew").show()
$("#passwordConfirm").show()
$("#btnReset").show()
$("#resetKey").show()
$("#emailReset").hide()
$("#btnSend").hide()
$("#dvloader").hide()
},
error: function(errorData) {
showFeedbackMessage(errorData.responseJSON.error.message, MessageTypesEnum.WARNING)
document.getElementById("dvloader").hidden = true;
$("#dvloader").hide()
}
})
}
function resetPassword() {
passwordNew = document.getElementById("passwordNew").value;
passwordConfirm = document.getElementById("passwordConfirm").value;
resetKey = document.getElementById("resetKey").value;
passwordNew = $("#passwordNew").val();
passwordConfirm = $("#passwordConfirm").val();
resetKey = $("#resetKey").val();
if ([passwordNew, passwordConfirm, resetKey].includes("")) {
showFeedbackMessage("Заполните все поля", MessageTypesEnum.WARNING);

View File

@ -10,7 +10,7 @@
<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>
class="fa fa-plane fa-4" aria-style="display:none"></i> Balance</span></a>
</div>
</nav>
<div layout:fragment="content">
@ -25,22 +25,22 @@
</div>
<div class="form-group">
<input type="password" name="email" id="passwordNew" class="form-control"
placeholder="Новый пароль" hidden="true"/>
placeholder="Новый пароль" style="display:none"/>
</div>
<div class="form-group">
<input type="password" name="email" id="passwordConfirm" class="form-control"
placeholder="Подтвердите пароль" hidden="true"/>
placeholder="Подтвердите пароль" style="display:none"/>
</div>
<div class="form-group">
<input type="text" name="email" id="resetKey" class="form-control"
placeholder="Код подтверждения" hidden="true"/>
placeholder="Код подтверждения" style="display:none"/>
</div>
<div id="dvloader" class="loader" hidden="true"><img src="../img/main/ajax-loader.gif" /></div>
<div id="dvloader" class="loader" style="display:none"><img src="../img/main/ajax-loader.gif" /></div>
<button id="btnSend" type="button" onclick="requestResetPassword()"
class="btn btn-success btn-block">
Отправить код подтверждения
</button>
<button id="btnReset" hidden="true" type="button" onclick="resetPassword()"
<button id="btnReset" style="display:none" type="button" onclick="resetPassword()"
class="btn btn-success btn-block">
Сбросить
пароль