@@ -39,60 +39,60 @@ |
||
39 | 39 | |
40 | 40 | class TwoFactor implements ISettings { |
41 | 41 | |
42 | - /** @var ProviderLoader */ |
|
43 | - private $providerLoader; |
|
42 | + /** @var ProviderLoader */ |
|
43 | + private $providerLoader; |
|
44 | 44 | |
45 | - /** @var IUserSession */ |
|
46 | - private $userSession; |
|
45 | + /** @var IUserSession */ |
|
46 | + private $userSession; |
|
47 | 47 | |
48 | - /** @var string|null */ |
|
49 | - private $uid; |
|
48 | + /** @var string|null */ |
|
49 | + private $uid; |
|
50 | 50 | |
51 | - /** @var IConfig */ |
|
52 | - private $config; |
|
51 | + /** @var IConfig */ |
|
52 | + private $config; |
|
53 | 53 | |
54 | - public function __construct(ProviderLoader $providerLoader, |
|
55 | - IUserSession $userSession, |
|
56 | - IConfig $config, |
|
57 | - ?string $UserId) { |
|
58 | - $this->providerLoader = $providerLoader; |
|
59 | - $this->userSession = $userSession; |
|
60 | - $this->uid = $UserId; |
|
61 | - $this->config = $config; |
|
62 | - } |
|
54 | + public function __construct(ProviderLoader $providerLoader, |
|
55 | + IUserSession $userSession, |
|
56 | + IConfig $config, |
|
57 | + ?string $UserId) { |
|
58 | + $this->providerLoader = $providerLoader; |
|
59 | + $this->userSession = $userSession; |
|
60 | + $this->uid = $UserId; |
|
61 | + $this->config = $config; |
|
62 | + } |
|
63 | 63 | |
64 | - public function getForm(): TemplateResponse { |
|
65 | - return new TemplateResponse('settings', 'settings/personal/security/twofactor', [ |
|
66 | - 'twoFactorProviderData' => $this->getTwoFactorProviderData(), |
|
67 | - 'themedark' => $this->config->getUserValue($this->uid, 'accessibility', 'theme', false) |
|
68 | - ]); |
|
64 | + public function getForm(): TemplateResponse { |
|
65 | + return new TemplateResponse('settings', 'settings/personal/security/twofactor', [ |
|
66 | + 'twoFactorProviderData' => $this->getTwoFactorProviderData(), |
|
67 | + 'themedark' => $this->config->getUserValue($this->uid, 'accessibility', 'theme', false) |
|
68 | + ]); |
|
69 | 69 | |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - public function getSection(): string { |
|
73 | - return 'security'; |
|
74 | - } |
|
72 | + public function getSection(): string { |
|
73 | + return 'security'; |
|
74 | + } |
|
75 | 75 | |
76 | - public function getPriority(): int { |
|
77 | - return 15; |
|
78 | - } |
|
76 | + public function getPriority(): int { |
|
77 | + return 15; |
|
78 | + } |
|
79 | 79 | |
80 | - private function getTwoFactorProviderData(): array { |
|
81 | - $user = $this->userSession->getUser(); |
|
82 | - if (is_null($user)) { |
|
83 | - // Actually impossible, but still … |
|
84 | - return []; |
|
85 | - } |
|
80 | + private function getTwoFactorProviderData(): array { |
|
81 | + $user = $this->userSession->getUser(); |
|
82 | + if (is_null($user)) { |
|
83 | + // Actually impossible, but still … |
|
84 | + return []; |
|
85 | + } |
|
86 | 86 | |
87 | - return [ |
|
88 | - 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
89 | - return [ |
|
90 | - 'provider' => $provider, |
|
91 | - 'settings' => $provider->getPersonalSettings($user) |
|
92 | - ]; |
|
93 | - }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
94 | - return $provider instanceof IProvidesPersonalSettings; |
|
95 | - })) |
|
96 | - ]; |
|
97 | - } |
|
87 | + return [ |
|
88 | + 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
89 | + return [ |
|
90 | + 'provider' => $provider, |
|
91 | + 'settings' => $provider->getPersonalSettings($user) |
|
92 | + ]; |
|
93 | + }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
94 | + return $provider instanceof IProvidesPersonalSettings; |
|
95 | + })) |
|
96 | + ]; |
|
97 | + } |
|
98 | 98 | } |
@@ -33,35 +33,35 @@ |
||
33 | 33 | |
34 | 34 | class Security implements ISettings { |
35 | 35 | |
36 | - /** @var IUserManager */ |
|
37 | - private $userManager; |
|
36 | + /** @var IUserManager */ |
|
37 | + private $userManager; |
|
38 | 38 | |
39 | - /** @var string|null */ |
|
40 | - private $uid; |
|
39 | + /** @var string|null */ |
|
40 | + private $uid; |
|
41 | 41 | |
42 | - public function __construct(IUserManager $userManager, |
|
43 | - ?string $UserId) { |
|
44 | - $this->userManager = $userManager; |
|
45 | - $this->uid = $UserId; |
|
46 | - } |
|
42 | + public function __construct(IUserManager $userManager, |
|
43 | + ?string $UserId) { |
|
44 | + $this->userManager = $userManager; |
|
45 | + $this->uid = $UserId; |
|
46 | + } |
|
47 | 47 | |
48 | - public function getForm(): TemplateResponse { |
|
49 | - $user = $this->userManager->get($this->uid); |
|
50 | - $passwordChangeSupported = false; |
|
51 | - if ($user !== null) { |
|
52 | - $passwordChangeSupported = $user->canChangePassword(); |
|
53 | - } |
|
48 | + public function getForm(): TemplateResponse { |
|
49 | + $user = $this->userManager->get($this->uid); |
|
50 | + $passwordChangeSupported = false; |
|
51 | + if ($user !== null) { |
|
52 | + $passwordChangeSupported = $user->canChangePassword(); |
|
53 | + } |
|
54 | 54 | |
55 | - return new TemplateResponse('settings', 'settings/personal/security', [ |
|
56 | - 'passwordChangeSupported' => $passwordChangeSupported, |
|
57 | - ]); |
|
58 | - } |
|
55 | + return new TemplateResponse('settings', 'settings/personal/security', [ |
|
56 | + 'passwordChangeSupported' => $passwordChangeSupported, |
|
57 | + ]); |
|
58 | + } |
|
59 | 59 | |
60 | - public function getSection(): string { |
|
61 | - return 'security'; |
|
62 | - } |
|
60 | + public function getSection(): string { |
|
61 | + return 'security'; |
|
62 | + } |
|
63 | 63 | |
64 | - public function getPriority(): int { |
|
65 | - return 10; |
|
66 | - } |
|
64 | + public function getPriority(): int { |
|
65 | + return 10; |
|
66 | + } |
|
67 | 67 | } |
@@ -35,29 +35,29 @@ |
||
35 | 35 | <li> |
36 | 36 | <?php |
37 | 37 | |
38 | - /** @var \OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings $provider */ |
|
39 | - $provider = $data['provider']; |
|
40 | - //Handle 2FA provider icons and theme |
|
41 | - if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) { |
|
42 | - if ($_['themedark']) { |
|
43 | - $icon = $provider->getLightIcon(); |
|
44 | - } |
|
45 | - else { |
|
46 | - $icon = $provider->getDarkIcon(); |
|
47 | - } |
|
48 | - //fallback icon if the 2factor provider doesn't provide an icon. |
|
49 | - } else { |
|
50 | - if ($_['themedark']) { |
|
51 | - $icon = image_path('core', 'actions/password-white.svg'); |
|
52 | - } |
|
53 | - else { |
|
54 | - $icon = image_path('core', 'actions/password.svg'); |
|
55 | - } |
|
38 | + /** @var \OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings $provider */ |
|
39 | + $provider = $data['provider']; |
|
40 | + //Handle 2FA provider icons and theme |
|
41 | + if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) { |
|
42 | + if ($_['themedark']) { |
|
43 | + $icon = $provider->getLightIcon(); |
|
44 | + } |
|
45 | + else { |
|
46 | + $icon = $provider->getDarkIcon(); |
|
47 | + } |
|
48 | + //fallback icon if the 2factor provider doesn't provide an icon. |
|
49 | + } else { |
|
50 | + if ($_['themedark']) { |
|
51 | + $icon = image_path('core', 'actions/password-white.svg'); |
|
52 | + } |
|
53 | + else { |
|
54 | + $icon = image_path('core', 'actions/password.svg'); |
|
55 | + } |
|
56 | 56 | |
57 | - } |
|
58 | - /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */ |
|
59 | - $settings = $data['settings']; |
|
60 | - ?> |
|
57 | + } |
|
58 | + /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */ |
|
59 | + $settings = $data['settings']; |
|
60 | + ?> |
|
61 | 61 | <h3> |
62 | 62 | <img class="two-factor-provider-settings-icon" src="<?php p($icon) ?>" alt=""> |
63 | 63 | <?php p($provider->getDisplayName()) ?> |
@@ -22,13 +22,13 @@ |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | script('settings', [ |
25 | - 'settings', |
|
26 | - 'templates', |
|
27 | - 'vue-settings-personal-security', |
|
25 | + 'settings', |
|
26 | + 'templates', |
|
27 | + 'vue-settings-personal-security', |
|
28 | 28 | ]); |
29 | 29 | |
30 | 30 | if($_['passwordChangeSupported']) { |
31 | - script('settings', 'security_password'); |
|
31 | + script('settings', 'security_password'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | ?> |