mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
Merge pull request #1085 from jc21/improved-new-password-error-messages
Improved new password error messages
This commit is contained in:
commit
5269c957ce
@ -4,6 +4,7 @@
|
|||||||
<button type="button" class="close cancel" aria-label="Close" data-dismiss="modal"> </button>
|
<button type="button" class="close cancel" aria-label="Close" data-dismiss="modal"> </button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
<div class="alert alert-danger" id="error-info" role="alert"></div>
|
||||||
<form>
|
<form>
|
||||||
<% if (isSelf()) { %>
|
<% if (isSelf()) { %>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -15,7 +16,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label"><%- i18n('users', 'new-password') %></label>
|
<label class="form-label"><%- i18n('users', 'new-password') %></label>
|
||||||
<input type="password" name="new_password1" class="form-control" placeholder="" minlength="8" required>
|
<input type="password" name="new_password1" class="form-control" placeholder="" minlength="8" required>
|
||||||
<div class="invalid-feedback secret-error"></div>
|
<div class="invalid-feedback new-secret-error"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label"><%- i18n('users', 'confirm-password') %></label>
|
<label class="form-label"><%- i18n('users', 'confirm-password') %></label>
|
||||||
|
@ -9,21 +9,23 @@ module.exports = Mn.View.extend({
|
|||||||
className: 'modal-dialog',
|
className: 'modal-dialog',
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
form: 'form',
|
form: 'form',
|
||||||
buttons: '.modal-footer button',
|
buttons: '.modal-footer button',
|
||||||
cancel: 'button.cancel',
|
cancel: 'button.cancel',
|
||||||
save: 'button.save',
|
save: 'button.save',
|
||||||
error: '.secret-error'
|
newSecretError: '.new-secret-error',
|
||||||
|
generalError: '#error-info',
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
'click @ui.save': function (e) {
|
'click @ui.save': function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.ui.error.hide();
|
this.ui.newSecretError.hide();
|
||||||
|
this.ui.generalError.hide();
|
||||||
let form = this.ui.form.serializeJSON();
|
let form = this.ui.form.serializeJSON();
|
||||||
|
|
||||||
if (form.new_password1 !== form.new_password2) {
|
if (form.new_password1 !== form.new_password2) {
|
||||||
this.ui.error.text('Passwords do not match!').show();
|
this.ui.newSecretError.text('Passwords do not match!').show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +42,11 @@ module.exports = Mn.View.extend({
|
|||||||
App.Controller.showUsers();
|
App.Controller.showUsers();
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
this.ui.error.text(err.message).show();
|
// Change error message to make it a little clearer
|
||||||
|
if (err.message === 'Invalid password') {
|
||||||
|
err.message = 'Current password is invalid';
|
||||||
|
}
|
||||||
|
this.ui.generalError.text(err.message).show();
|
||||||
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
|
this.ui.buttons.prop('disabled', false).removeClass('btn-disabled');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -54,5 +60,10 @@ module.exports = Mn.View.extend({
|
|||||||
return {
|
return {
|
||||||
isSelf: this.isSelf.bind(this)
|
isSelf: this.isSelf.bind(this)
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
|
|
||||||
|
onRender: function () {
|
||||||
|
this.ui.newSecretError.hide();
|
||||||
|
this.ui.generalError.hide();
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user