Skip to content

Commit

Permalink
check for conditions to show the prompt and button
Browse files Browse the repository at this point in the history
Signed-off-by: MohammadReza vahedi <[email protected]>
  • Loading branch information
mrvahedi68 committed Sep 10, 2023
1 parent f2f28e5 commit 248823d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions js/tabview.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
<br/>
<br/>
<div id="need-mfa" style="--icon-size:36px;">
<label for="Enable2FAButton">You need to login with two factor authentication to use this feature.</label><br><br>
<button id="Enable2FAButton" type="button">Enable 2FA</button>
<label for="enable-2fa-button">You need to login with two factor authentication to use this feature.</label><br><br>
<button id="enable-2fa-button">Enable 2FA</button>
</div>
</div>
`;
Expand Down Expand Up @@ -205,6 +205,13 @@
success: function (response) {
self.document.getElementById('checkbox-radio-switch-mfa')
.checked = response.status;
if (response.mfa_passed){
context.$el.find('#need-mfa')
.hide();
} else {
context.$el.find('#enable-2fa-button')
.click(context.showDialog);
}
if (enabled) {
context.$el.find('#checkbox-radio-switch-mfa')
.click(context.boxChecked);
Expand All @@ -218,6 +225,11 @@
},
});
},
showDialog: function () {
if (confirm('You must enable two factor authentication to use MFAZone app. do you want to enable 2FA?')) {
window.location.href = '../../settings/user/security';
}
},
boxChecked: function () {
const checkBox = this;
const setUrl = OC.generateUrl('/apps/mfazones/set'),
Expand Down

0 comments on commit 248823d

Please sign in to comment.