Skip to content

Commit ee96b88

Browse files
committed
Remove permission user/two-factor-authentication
The user should not need to ask for more security.
1 parent 3ca6f71 commit ee96b88

2 files changed

Lines changed: 14 additions & 18 deletions

File tree

application/controllers/AccountController.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,24 +74,23 @@ public function indexAction()
7474
}
7575
}
7676

77-
if ($user->can('user/two-factor-authentication')) {
78-
$twoFactor = TwoFactorTotp::loadFromDb($this->getDb(), $user->getUsername());
79-
if ($twoFactor === null) {
80-
$twoFactor = TwoFactorTotp::generate($user->getUsername());
77+
$twoFactor = TwoFactorTotp::loadFromDb($this->getDb(), $user->getUsername());
78+
if ($twoFactor === null) {
79+
$twoFactor = TwoFactorTotp::generate($user->getUsername());
80+
}
81+
82+
$twoFactorForm = new TwoFactorConfigForm();
83+
$twoFactorForm->setUser($user);
84+
$twoFactorForm->setTwoFactor($twoFactor);
85+
$twoFactorForm->on(Form::ON_SUBMIT, function (TwoFactorConfigForm $form) {
86+
if ($redirectUrl = $form->getRedirectUrl()) {
87+
$this->redirectNow($redirectUrl);
8188
}
89+
});
90+
$twoFactorForm->handleRequest(ServerRequest::fromGlobals());
8291

83-
$twoFactorForm = new TwoFactorConfigForm();
84-
$twoFactorForm->setUser($user);
85-
$twoFactorForm->setTwoFactor($twoFactor);
86-
$twoFactorForm->on(Form::ON_SUBMIT, function (TwoFactorConfigForm $form) {
87-
if ($redirectUrl = $form->getRedirectUrl()) {
88-
$this->redirectNow($redirectUrl);
89-
}
90-
});
91-
$twoFactorForm->handleRequest(ServerRequest::fromGlobals());
92+
$this->view->twoFactorForm = $twoFactorForm;
9293

93-
$this->view->twoFactorForm = $twoFactorForm;
94-
}
9594

9695
$form = new PreferenceForm();
9796
$form->setPreferences($user->getPreferences());

application/forms/Security/RoleForm.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,9 +573,6 @@ public static function collectProvidedPrivileges()
573573
'user/password-change' => [
574574
'description' => t('Allow password changes in the account preferences')
575575
],
576-
'user/two-factor-authentication'=> [
577-
'description' => t('Allow 2FA configuration in the account preferences')
578-
],
579576
'user/application/stacktraces' => [
580577
'description' => t('Allow to adjust in the preferences whether to show stacktraces')
581578
],

0 commit comments

Comments
 (0)