From: Tim Düsterhus Date: Fri, 13 Nov 2020 14:40:02 +0000 (+0100) Subject: Disallow management of backup codes if they are not set up X-Git-Tag: 5.4.0_Alpha_1~555^2~53^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fd5a80d4b333d7d9af3726d74c1b7646d69df4c6;p=GitHub%2FWoltLab%2FWCF.git Disallow management of backup codes if they are not set up --- diff --git a/com.woltlab.wcf/templates/accountSecurity.tpl b/com.woltlab.wcf/templates/accountSecurity.tpl index 810b2556ae..e176940f3b 100644 --- a/com.woltlab.wcf/templates/accountSecurity.tpl +++ b/com.woltlab.wcf/templates/accountSecurity.tpl @@ -7,35 +7,37 @@ diff --git a/wcfsetup/install/files/lib/form/MultifactorManageForm.class.php b/wcfsetup/install/files/lib/form/MultifactorManageForm.class.php index c3b706c2a8..ed2b7ae573 100644 --- a/wcfsetup/install/files/lib/form/MultifactorManageForm.class.php +++ b/wcfsetup/install/files/lib/form/MultifactorManageForm.class.php @@ -4,6 +4,7 @@ use wcf\data\object\type\ObjectType; use wcf\data\object\type\ObjectTypeCache; use wcf\form\AbstractFormBuilderForm; use wcf\system\exception\IllegalLinkException; +use wcf\system\exception\PermissionDeniedException; use wcf\system\menu\user\UserMenu; use wcf\system\request\LinkHandler; use wcf\system\user\multifactor\IMultifactorMethod; @@ -72,6 +73,11 @@ class MultifactorManageForm extends AbstractFormBuilderForm { $this->method = $objectType; $this->processor = $this->method->getProcessor(); $this->setup = Setup::find($this->method, WCF::getUser()); + + // Backup codes may not be managed if they are not yet set up. + if ($this->method->objectType === 'com.woltlab.wcf.multifactor.backup' && !$this->setup) { + throw new PermissionDeniedException(); + } } /**