Add page alert for wrong password

This commit is contained in:
amcmanu3 2022-07-05 20:27:10 -04:00
parent a498ef8986
commit 11b13fbcd6
2 changed files with 40 additions and 2 deletions

View File

@ -84,6 +84,9 @@
</small> </label>
<input type="password" class="form-control" name="password0" id="password0" value=""
autocomplete="new-password" data-lpignore="true" placeholder="Password">
<span class="passwords-match" ,
data-content="{{ translate('panelConfig', 'match', data['lang']) }}" ,
data-placement="right"></span>
</div>
<div class="form-group">
<label class="form-label" for="password1">{{ translate('userConfig', 'repeat', data['lang']) }}
@ -91,6 +94,9 @@
}}</small> </label>
<input type="password" class="form-control" name="password1" id="password1" value=""
autocomplete="new-password" data-lpignore="true" placeholder="Repeat Password">
<span class="passwords-match" ,
data-content="{{ translate('panelConfig', 'match', data['lang']) }}" ,
data-placement="right"></span>
</div>
<div class="form-group">
<label class="form-label" for="email">{{ translate('userConfig', 'gravEmail', data['lang'])
@ -237,7 +243,7 @@
</div>
<button type="submit" class="btn btn-success mr-2"><i class="fas fa-save"></i> {{
<button class="btn btn-success mr-2" onclick="submit_user(event);"><i class="fas fa-save"></i> {{
translate('panelConfig', 'save', data['lang']) }}</button>
<button type="reset" onclick="location.href='/panel/panel_config'" class="btn btn-light"><i
class="fas fa-undo-alt"></i> {{ translate('panelConfig', 'cancel', data['lang']) }}</button>
@ -290,12 +296,43 @@
</div>
<style>
.popover-body {
color: white !important;
outline: 1px solid red !important;
;
}
</style>
<!-- content-wrapper ends -->
{% end %}
{% block js %}
<script>
function submit_user(event) {
if (!validateForm()) {
event.preventDefault();
} else {
$('#userForm').submit();
}
}
function validateForm() {
let password0 = document.getElementById("password0").value
let password1 = document.getElementById("password1").value
if (password0 != password1) {
$('.passwords-match').popover('show');
$('.popover-body').click(function () {
$('.passwords-match').popover("hide");
});
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
$("#password0").css("outline", "1px solid red");
$("#password1").css("outline", "1px solid red");
return false;
} else {
return true;
}
}
const userId = new URLSearchParams(document.location.search).get('id')
$(".delete-user").click(function () {

View File

@ -220,7 +220,8 @@
"superConfirm": "Proceed only if you want this user to have access to EVERYTHING (all user accounts, servers, panel settings, etc.). They can even revoke your superuser rights.",
"superConfirmTitle": "Enable superuser? Are you sure?",
"user": "User",
"users": "Users"
"users": "Users",
"match": "Passwords must match"
},
"rolesConfig": {
"config": "Role Config",