mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-06-15 00:44:27 +00:00
Update messages
This commit is contained in:
parent
5d2a76adfe
commit
34194e65d2
@ -30,10 +30,11 @@ module.exports = {
|
|||||||
.where('user_id', userId)
|
.where('user_id', userId)
|
||||||
.first()
|
.first()
|
||||||
.then((auth) => {
|
.then((auth) => {
|
||||||
|
console.log(auth);
|
||||||
if (!auth) {
|
if (!auth) {
|
||||||
throw new error.AuthError('User not found.');
|
throw new error.AuthError('User not found.');
|
||||||
}
|
}
|
||||||
return auth.mfa_enabled === 1;
|
return auth.mfa_enabled === true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
createMfaSecretForUser: (userId) => {
|
createMfaSecretForUser: (userId) => {
|
||||||
@ -68,7 +69,7 @@ module.exports = {
|
|||||||
return authModel
|
return authModel
|
||||||
.query()
|
.query()
|
||||||
.where('user_id', userId)
|
.where('user_id', userId)
|
||||||
.update({ mfa_enabled: 1 })
|
.update({ mfa_enabled: true })
|
||||||
.then(() => true);
|
.then(() => true);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -27,11 +27,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-12 col-md-12">
|
<div class="col-sm-12 col-md-12">
|
||||||
<button type="button" class="btn btn-info add-mfa">Add MFA</button>
|
<label class="form-label mfa-label" style="display: none;"><%- i18n('mfa', 'mfa') %></label>
|
||||||
<p class="qr-instructions" style="display: none;">Scan this QR code in your authenticator app to set up MFA and then enter the current MFA code in the input field.</p>
|
<button type="button" class="btn btn-info add-mfa"><%- i18n('mfa', 'add-mfa') %></button>
|
||||||
|
<p class="qr-instructions" style="display: none;"><%- i18n('mfa', 'mfa-setup-instruction') %></p>
|
||||||
<div class="mfa-validation-container" style="display: none;">
|
<div class="mfa-validation-container" style="display: none;">
|
||||||
<label class="form-label"><%- i18n('str', 'mfa') %> <span class="form-required">*</span></label>
|
<label class="form-label"><%- i18n('mfa', 'mfa-token') %> <span class="form-required">*</span></label>
|
||||||
<input name="mfa_validation" type="text" class="form-control" placeholder="000000" value="" required>
|
<input name="mfa_validation" type="text" class="form-control" placeholder="000000" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ module.exports = Mn.View.extend({
|
|||||||
save: 'button.save',
|
save: 'button.save',
|
||||||
error: '.secret-error',
|
error: '.secret-error',
|
||||||
addMfa: '.add-mfa',
|
addMfa: '.add-mfa',
|
||||||
|
mfaLabel: '.mfa-label', // added binding
|
||||||
mfaValidation: '.mfa-validation-container', // added binding
|
mfaValidation: '.mfa-validation-container', // added binding
|
||||||
qrInstructions: '.qr-instructions' // added binding for instructions
|
qrInstructions: '.qr-instructions' // added binding for instructions
|
||||||
},
|
},
|
||||||
@ -99,6 +100,8 @@ module.exports = Mn.View.extend({
|
|||||||
view.ui.addMfa.replaceWith(`<img class="qr-code" src="${response.qrCode}" alt="QR Code">`);
|
view.ui.addMfa.replaceWith(`<img class="qr-code" src="${response.qrCode}" alt="QR Code">`);
|
||||||
view.ui.qrInstructions.show();
|
view.ui.qrInstructions.show();
|
||||||
view.ui.mfaValidation.show();
|
view.ui.mfaValidation.show();
|
||||||
|
// Add required attribute once MFA is activated
|
||||||
|
view.ui.mfaValidation.find('input[name="mfa_validation"]').attr('required', true);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
view.ui.error.text(err.message).show();
|
view.ui.error.text(err.message).show();
|
||||||
@ -140,12 +143,17 @@ module.exports = Mn.View.extend({
|
|||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.active) {
|
if (response.active) {
|
||||||
view.ui.addMfa.hide();
|
view.ui.addMfa.hide();
|
||||||
|
view.ui.mfaLabel.hide();
|
||||||
view.ui.qrInstructions.hide();
|
view.ui.qrInstructions.hide();
|
||||||
view.ui.mfaValidation.hide();
|
view.ui.mfaValidation.hide();
|
||||||
|
// Remove required attribute if MFA is active & field is hidden
|
||||||
|
view.ui.mfaValidation.find('input[name="mfa_validation"]').removeAttr('required');
|
||||||
} else {
|
} else {
|
||||||
view.ui.addMfa.show();
|
view.ui.addMfa.show();
|
||||||
|
view.ui.mfaLabel.show();
|
||||||
view.ui.qrInstructions.hide();
|
view.ui.qrInstructions.hide();
|
||||||
view.ui.mfaValidation.hide();
|
view.ui.mfaValidation.hide();
|
||||||
|
view.ui.mfaValidation.find('input[name="mfa_validation"]').removeAttr('required');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
"en": {
|
"en": {
|
||||||
"str": {
|
"str": {
|
||||||
"email-address": "Email address",
|
"email-address": "Email address",
|
||||||
"mfa": "Multi factor authentication token",
|
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
"password": "Password",
|
"password": "Password",
|
||||||
"sign-in": "Sign in",
|
"sign-in": "Sign in",
|
||||||
@ -38,9 +37,15 @@
|
|||||||
"all": "All",
|
"all": "All",
|
||||||
"any": "Any"
|
"any": "Any"
|
||||||
},
|
},
|
||||||
|
"mfa": {
|
||||||
|
"mfa": "Multi Factor Authentication",
|
||||||
|
"add-mfa": "Generate secret",
|
||||||
|
"mfa-setup-instruction": "Scan this QR code in your authenticator app to set up MFA and then enter the current MFA code in the input field.",
|
||||||
|
"mfa-token": "Multi factor authentication token"
|
||||||
|
},
|
||||||
"login": {
|
"login": {
|
||||||
"title": "Login to your account",
|
"title": "Login to your account",
|
||||||
"mfa_required_text": "Please enter your MFA token to continue"
|
"mfa-required-text": "Please enter your MFA token to continue"
|
||||||
},
|
},
|
||||||
"main": {
|
"main": {
|
||||||
"app": "Nginx Proxy Manager",
|
"app": "Nginx Proxy Manager",
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
<div class="invalid-feedback secret-error"></div>
|
<div class="invalid-feedback secret-error"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group mfa-group" style="display: none;">
|
<div class="form-group mfa-group" style="display: none;">
|
||||||
<p class="mfa-info"><%- i18n('login', 'mfa_required_text') %>:</p>
|
<p class="mfa-info"><%- i18n('login', 'mfa-required-text') %>:</p>
|
||||||
<label class="form-label"><%- i18n('str', 'mfa') %></label>
|
<label class="form-label"><%- i18n('mfa', 'mfa-token') %></label>
|
||||||
<input name="mfa_token" type="text" class="form-control" placeholder="<%- i18n('str', 'mfa') %>">
|
<input name="mfa_token" type="text" class="form-control" placeholder="<%- i18n('mfa', 'mfa-token') %>">
|
||||||
<div class="invalid-feedback mfa-error"></div>
|
<div class="invalid-feedback mfa-error"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-footer">
|
<div class="form-footer">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user