@@ -38,82 +38,82 @@ |
||
38 | 38 | |
39 | 39 | class Security implements ISettings { |
40 | 40 | |
41 | - /** @var IUserManager */ |
|
42 | - private $userManager; |
|
43 | - |
|
44 | - /** @var TwoFactorManager */ |
|
45 | - private $twoFactorManager; |
|
46 | - |
|
47 | - /** @var ProviderLoader */ |
|
48 | - private $providerLoader; |
|
49 | - |
|
50 | - /** @var IUserSession */ |
|
51 | - private $userSession; |
|
52 | - |
|
53 | - |
|
54 | - public function __construct(IUserManager $userManager, |
|
55 | - TwoFactorManager $providerManager, |
|
56 | - ProviderLoader $providerLoader, |
|
57 | - IUserSession $userSession) { |
|
58 | - $this->userManager = $userManager; |
|
59 | - $this->twoFactorManager = $providerManager; |
|
60 | - $this->providerLoader = $providerLoader; |
|
61 | - $this->userSession = $userSession; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
66 | - * @since 9.1 |
|
67 | - */ |
|
68 | - public function getForm() { |
|
69 | - $user = $this->userManager->get(\OC_User::getUser()); |
|
70 | - $passwordChangeSupported = false; |
|
71 | - if ($user !== null) { |
|
72 | - $passwordChangeSupported = $user->canChangePassword(); |
|
73 | - } |
|
74 | - |
|
75 | - return new TemplateResponse('settings', 'settings/personal/security', [ |
|
76 | - 'passwordChangeSupported' => $passwordChangeSupported, |
|
77 | - 'twoFactorProviderData' => $this->getTwoFactorProviderData(), |
|
78 | - ]); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * @return string the section ID, e.g. 'sharing' |
|
83 | - * @since 9.1 |
|
84 | - */ |
|
85 | - public function getSection() { |
|
86 | - return 'security'; |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @return int whether the form should be rather on the top or bottom of |
|
91 | - * the admin section. The forms are arranged in ascending order of the |
|
92 | - * priority values. It is required to return a value between 0 and 100. |
|
93 | - * |
|
94 | - * E.g.: 70 |
|
95 | - * @since 9.1 |
|
96 | - */ |
|
97 | - public function getPriority() { |
|
98 | - return 10; |
|
99 | - } |
|
100 | - |
|
101 | - private function getTwoFactorProviderData(): array { |
|
102 | - $user = $this->userSession->getUser(); |
|
103 | - if (is_null($user)) { |
|
104 | - // Actually impossible, but still … |
|
105 | - return []; |
|
106 | - } |
|
107 | - |
|
108 | - return [ |
|
109 | - 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
110 | - return [ |
|
111 | - 'provider' => $provider, |
|
112 | - 'settings' => $provider->getPersonalSettings($user) |
|
113 | - ]; |
|
114 | - }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
115 | - return $provider instanceof IProvidesPersonalSettings; |
|
116 | - })) |
|
117 | - ]; |
|
118 | - } |
|
41 | + /** @var IUserManager */ |
|
42 | + private $userManager; |
|
43 | + |
|
44 | + /** @var TwoFactorManager */ |
|
45 | + private $twoFactorManager; |
|
46 | + |
|
47 | + /** @var ProviderLoader */ |
|
48 | + private $providerLoader; |
|
49 | + |
|
50 | + /** @var IUserSession */ |
|
51 | + private $userSession; |
|
52 | + |
|
53 | + |
|
54 | + public function __construct(IUserManager $userManager, |
|
55 | + TwoFactorManager $providerManager, |
|
56 | + ProviderLoader $providerLoader, |
|
57 | + IUserSession $userSession) { |
|
58 | + $this->userManager = $userManager; |
|
59 | + $this->twoFactorManager = $providerManager; |
|
60 | + $this->providerLoader = $providerLoader; |
|
61 | + $this->userSession = $userSession; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
66 | + * @since 9.1 |
|
67 | + */ |
|
68 | + public function getForm() { |
|
69 | + $user = $this->userManager->get(\OC_User::getUser()); |
|
70 | + $passwordChangeSupported = false; |
|
71 | + if ($user !== null) { |
|
72 | + $passwordChangeSupported = $user->canChangePassword(); |
|
73 | + } |
|
74 | + |
|
75 | + return new TemplateResponse('settings', 'settings/personal/security', [ |
|
76 | + 'passwordChangeSupported' => $passwordChangeSupported, |
|
77 | + 'twoFactorProviderData' => $this->getTwoFactorProviderData(), |
|
78 | + ]); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * @return string the section ID, e.g. 'sharing' |
|
83 | + * @since 9.1 |
|
84 | + */ |
|
85 | + public function getSection() { |
|
86 | + return 'security'; |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @return int whether the form should be rather on the top or bottom of |
|
91 | + * the admin section. The forms are arranged in ascending order of the |
|
92 | + * priority values. It is required to return a value between 0 and 100. |
|
93 | + * |
|
94 | + * E.g.: 70 |
|
95 | + * @since 9.1 |
|
96 | + */ |
|
97 | + public function getPriority() { |
|
98 | + return 10; |
|
99 | + } |
|
100 | + |
|
101 | + private function getTwoFactorProviderData(): array { |
|
102 | + $user = $this->userSession->getUser(); |
|
103 | + if (is_null($user)) { |
|
104 | + // Actually impossible, but still … |
|
105 | + return []; |
|
106 | + } |
|
107 | + |
|
108 | + return [ |
|
109 | + 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
110 | + return [ |
|
111 | + 'provider' => $provider, |
|
112 | + 'settings' => $provider->getPersonalSettings($user) |
|
113 | + ]; |
|
114 | + }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
115 | + return $provider instanceof IProvidesPersonalSettings; |
|
116 | + })) |
|
117 | + ]; |
|
118 | + } |
|
119 | 119 | } |
@@ -106,12 +106,12 @@ |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | return [ |
109 | - 'providers' => array_map(function (IProvidesPersonalSettings $provider) use ($user) { |
|
109 | + 'providers' => array_map(function(IProvidesPersonalSettings $provider) use ($user) { |
|
110 | 110 | return [ |
111 | 111 | 'provider' => $provider, |
112 | 112 | 'settings' => $provider->getPersonalSettings($user) |
113 | 113 | ]; |
114 | - }, array_filter($this->providerLoader->getProviders($user), function (IProvider $provider) { |
|
114 | + }, array_filter($this->providerLoader->getProviders($user), function(IProvider $provider) { |
|
115 | 115 | return $provider instanceof IProvidesPersonalSettings; |
116 | 116 | })) |
117 | 117 | ]; |
@@ -22,18 +22,18 @@ discard block |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | script('settings', [ |
25 | - 'authtoken', |
|
26 | - 'authtoken_collection', |
|
27 | - 'templates', |
|
28 | - 'authtoken_view', |
|
29 | - 'settings/authtoken-init' |
|
25 | + 'authtoken', |
|
26 | + 'authtoken_collection', |
|
27 | + 'templates', |
|
28 | + 'authtoken_view', |
|
29 | + 'settings/authtoken-init' |
|
30 | 30 | ]); |
31 | 31 | |
32 | 32 | if($_['passwordChangeSupported']) { |
33 | - script('settings', 'security_password'); |
|
34 | - script('jquery-showpassword'); |
|
35 | - vendor_script('strengthify/jquery.strengthify'); |
|
36 | - vendor_style('strengthify/strengthify'); |
|
33 | + script('settings', 'security_password'); |
|
34 | + script('jquery-showpassword'); |
|
35 | + vendor_script('strengthify/jquery.strengthify'); |
|
36 | + vendor_style('strengthify/strengthify'); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | ?> |
@@ -108,16 +108,16 @@ discard block |
||
108 | 108 | <?php foreach ($_['twoFactorProviderData']['providers'] as $data) { ?> |
109 | 109 | <li> |
110 | 110 | <?php |
111 | - /** @var \OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings $provider */ |
|
112 | - $provider = $data['provider']; |
|
113 | - if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) { |
|
114 | - $icon = $provider->getDarkIcon(); |
|
115 | - } else { |
|
116 | - $icon = image_path('core', 'actions/password.svg'); |
|
117 | - } |
|
118 | - /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */ |
|
119 | - $settings = $data['settings']; |
|
120 | - ?> |
|
111 | + /** @var \OCP\Authentication\TwoFactorAuth\IProvidesPersonalSettings $provider */ |
|
112 | + $provider = $data['provider']; |
|
113 | + if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) { |
|
114 | + $icon = $provider->getDarkIcon(); |
|
115 | + } else { |
|
116 | + $icon = image_path('core', 'actions/password.svg'); |
|
117 | + } |
|
118 | + /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */ |
|
119 | + $settings = $data['settings']; |
|
120 | + ?> |
|
121 | 121 | <h3> |
122 | 122 | <img class="two-factor-provider-settings-icon" src="<?php p($icon) ?>" alt=""> |
123 | 123 | <?php p($provider->getDisplayName()) ?> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | 'settings/authtoken-init' |
30 | 30 | ]); |
31 | 31 | |
32 | -if($_['passwordChangeSupported']) { |
|
32 | +if ($_['passwordChangeSupported']) { |
|
33 | 33 | script('settings', 'security_password'); |
34 | 34 | script('jquery-showpassword'); |
35 | 35 | vendor_script('strengthify/jquery.strengthify'); |
@@ -37,19 +37,19 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | ?> |
40 | -<?php if($_['passwordChangeSupported']) { ?> |
|
40 | +<?php if ($_['passwordChangeSupported']) { ?> |
|
41 | 41 | <div id="security-password" class="section"> |
42 | - <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> |
|
42 | + <h2 class="inlineblock"><?php p($l->t('Password')); ?></h2> |
|
43 | 43 | <span id="password-error-msg" class="msg success hidden">Saved</span> |
44 | 44 | <div class="personal-settings-setting-box personal-settings-password-box"> |
45 | 45 | <form id="passwordform"> |
46 | 46 | <label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label> |
47 | 47 | <input type="password" id="pass1" name="oldpassword" |
48 | - placeholder="<?php p($l->t('Current password'));?>" |
|
48 | + placeholder="<?php p($l->t('Current password')); ?>" |
|
49 | 49 | autocomplete="off" autocapitalize="none" autocorrect="off" /> |
50 | 50 | |
51 | 51 | <div class="personal-show-container"> |
52 | - <label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label> |
|
52 | + <label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label> |
|
53 | 53 | <input type="password" id="pass2" name="newpassword" |
54 | 54 | placeholder="<?php p($l->t('New password')); ?>" |
55 | 55 | data-typetoggle="#personal-show" |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | <?php } ?> |
67 | 67 | |
68 | 68 | <div id="security" class="section"> |
69 | - <h2><?php p($l->t('Devices & sessions'));?></h2> |
|
70 | - <p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.'));?></p> |
|
69 | + <h2><?php p($l->t('Devices & sessions')); ?></h2> |
|
70 | + <p class="settings-hint hidden-when-empty"><?php p($l->t('Web, desktop and mobile clients currently logged in to your account.')); ?></p> |
|
71 | 71 | <table class="icon-loading"> |
72 | 72 | <thead class="token-list-header"> |
73 | 73 | <tr> |
74 | 74 | <th></th> |
75 | - <th><?php p($l->t('Device'));?></th> |
|
76 | - <th><?php p($l->t('Last activity'));?></th> |
|
75 | + <th><?php p($l->t('Device')); ?></th> |
|
76 | + <th><?php p($l->t('Last activity')); ?></th> |
|
77 | 77 | <th></th> |
78 | 78 | </tr> |
79 | 79 | </thead> |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | </div> |
104 | 104 | |
105 | 105 | <div id="two-factor-auth" class="section"> |
106 | - <h2><?php p($l->t('Two-Factor Authentication'));?></h2> |
|
106 | + <h2><?php p($l->t('Two-Factor Authentication')); ?></h2> |
|
107 | 107 | <ul> |
108 | 108 | <?php foreach ($_['twoFactorProviderData']['providers'] as $data) { ?> |
109 | 109 | <li> |