Skip to content

Commit e8d157d

Browse files
authored
Hide Disable 2FA button if not enabled (#3682)
1 parent b813f8c commit e8d157d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

custom/panel_templates/Default/core/users_edit.tpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,12 @@
262262
<form style="display:none" action="{$VALIDATE_USER_LINK}" method="post" id="validateUserForm">
263263
<input type="hidden" name="token" value="{$TOKEN}" />
264264
</form>
265-
<form style="display:none" action="{$DISABLE_TFA_LINK}" method="post" id="disableTfaForm">
266-
<input type="hidden" name="token" value="{$TOKEN}" />
267-
</form>
268265

266+
{if isset($DISABLE_TFA_LINK)}
267+
<form style="display:none" action="{$DISABLE_TFA_LINK}" method="post" id="disableTfaForm">
268+
<input type="hidden" name="token" value="{$TOKEN}" />
269+
</form>
270+
{/if}
269271

270272
{include file='scripts.tpl'}
271273

modules/Core/pages/panel/users_edit.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,14 @@
331331
'NEW_PASSWORD' => $language->get('user', 'new_password'),
332332
'CONFIRM_NEW_PASSWORD' => $language->get('user', 'confirm_new_password'),
333333
'CHANGE_PASSWORD' => $language->get('user', 'change_password'),
334-
335-
'DISABLE_TFA' => $language->get('admin', 'disable_tfa'),
336-
'DISABLE_TFA_LINK' => URL::build('/panel/users/edit/', 'id=' . urlencode($user_query->id) . '&action=disable_tfa')
337334
]);
335+
336+
if ($view_user->data()->tfa_complete) {
337+
$template->getEngine()->addVariables([
338+
'DISABLE_TFA' => $language->get('admin', 'disable_tfa'),
339+
'DISABLE_TFA_LINK' => URL::build('/panel/users/edit/', 'id=' . urlencode($user_query->id) . '&action=disable_tfa')
340+
]);
341+
}
338342
}
339343

340344
$limit_groups = false;

0 commit comments

Comments
 (0)