@@ -49,7 +49,8 @@ |
||
49 | 49 | RequestStack $requestStack, |
50 | 50 | TranslatorInterface $translator, |
51 | 51 | VariableApiInterface $variableApi, |
52 | - LoggerInterface $logger) { |
|
52 | + LoggerInterface $logger) |
|
53 | + { |
|
53 | 54 | parent::__construct($extension, $managerRegistry, $schemaTool, $requestStack, $translator, $variableApi); |
54 | 55 | $this->logger = $logger; |
55 | 56 | } |
@@ -179,8 +179,8 @@ |
||
179 | 179 | if (1 === mb_strlen($saltDelimiter) && false !== mb_strpos($saltedHash, $saltDelimiter)) { |
180 | 180 | [$hashMethod, $saltStr, $correctHash] = explode($saltDelimiter, $saltedHash); |
181 | 181 | |
182 | - if (is_numeric($hashMethod) && ((int)$hashMethod === $hashMethod)) { |
|
183 | - $hashMethod = (int)$hashMethod; |
|
182 | + if (is_numeric($hashMethod) && ((int) $hashMethod === $hashMethod)) { |
|
183 | + $hashMethod = (int) $hashMethod; |
|
184 | 184 | } |
185 | 185 | $hashMethodName = $hashMethodCodeToName[$hashMethod] ?? $hashMethod; |
186 | 186 |
@@ -307,7 +307,7 @@ |
||
307 | 307 | $data = $form->getData(); |
308 | 308 | $code = bin2hex(random_bytes(8)); |
309 | 309 | $hashedCode = $encoderFactory->getEncoder(AuthenticationMappingEntity::class)->encodePassword($code, null); |
310 | - $currentUserId = (int)$currentUserApi->get('uid'); |
|
310 | + $currentUserId = (int) $currentUserApi->get('uid'); |
|
311 | 311 | $userVerificationRepository->setVerificationCode($currentUserId, ZAuthConstant::VERIFYCHGTYPE_EMAIL, $hashedCode, $data['email']); |
312 | 312 | $templateArgs = [ |
313 | 313 | 'uname' => $currentUserApi->get('uname'), |
@@ -77,7 +77,8 @@ discard block |
||
77 | 77 | |
78 | 78 | $passwordEncoder = $this->encoderFactory->getEncoder(AuthenticationMappingEntity::class); |
79 | 79 | |
80 | - if (empty($user) || $user['uid'] <= 1) { // || !$passwordEncoder->isPasswordValid($user['pass'], $object['password'], null)) { |
|
80 | + if (empty($user) || $user['uid'] <= 1) { |
|
81 | +// || !$passwordEncoder->isPasswordValid($user['pass'], $object['password'], null)) { |
|
81 | 82 | $this->context |
82 | 83 | ->buildViolation($this->trans('Error! Could not login because the user could not be found. Please try again.')) |
83 | 84 | ->addViolation(); |
@@ -92,7 +93,8 @@ discard block |
||
92 | 93 | // new way |
93 | 94 | $passwordEncoder->isPasswordValid($user['pass'], $object['password'], null)) { |
94 | 95 | $validPassword = true; |
95 | - if ($passwordEncoder->needsRehash($user['pass'])) { // check to update hash to newer algo |
|
96 | + if ($passwordEncoder->needsRehash($user['pass'])) { |
|
97 | +// check to update hash to newer algo |
|
96 | 98 | $this->setPassword((int) $user['uid'], $object['password']); |
97 | 99 | } |
98 | 100 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public function hasPermission(string $component = null, string $instance = null, int $level = ACCESS_NONE, int $user = null): bool |
91 | 91 | { |
92 | 92 | if (!isset($user)) { |
93 | - $user = (int)$this->currentUserApi->get('uid'); |
|
93 | + $user = (int) $this->currentUserApi->get('uid'); |
|
94 | 94 | } |
95 | 95 | $user = !$user ? Constant::USER_ID_ANONYMOUS : $user; |
96 | 96 | if (!isset($this->groupPermsByUser[$user]) || false === $this->groupPermsByUser[$user]) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | foreach ($permsByGroup as $perm) { |
133 | 133 | $component = $this->normalizeRegexString($perm['component']); |
134 | 134 | $instance = $this->normalizeRegexString($perm['instance']); |
135 | - $level = (int)$perm['level']; // this string must be a numeric and not normalized. |
|
135 | + $level = (int) $perm['level']; // this string must be a numeric and not normalized. |
|
136 | 136 | $groupPerms[] = [ |
137 | 137 | 'component' => $component, |
138 | 138 | 'instance' => $instance, |
@@ -67,7 +67,7 @@ |
||
67 | 67 | $this->currentUserApi |
68 | 68 | ->method('get') |
69 | 69 | ->with($this->equalTo('uid')) |
70 | - ->willReturnCallback(static function () use ($userId) { |
|
70 | + ->willReturnCallback(static function() use ($userId) { |
|
71 | 71 | return $userId ?? Constant::USER_ID_ANONYMOUS; |
72 | 72 | }); |
73 | 73 | $api = new PermissionApi($this->permRepo, $this->userRepo, $this->currentUserApi, $this->translator); |
@@ -74,7 +74,7 @@ |
||
74 | 74 | $this->userRepo |
75 | 75 | ->method('findByUids') |
76 | 76 | ->with($this->anything()) |
77 | - ->willReturnCallback(function (array $uids) { |
|
77 | + ->willReturnCallback(function(array $uids) { |
|
78 | 78 | $groups = new ArrayCollection(); |
79 | 79 | // getGroups returns [gid => $group, gid => $group, ...] |
80 | 80 | if (in_array(self::RANDOM_USER_ID, $uids, true)) { |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | PermissionRepositoryInterface $permissionRepository |
46 | 46 | ) { |
47 | 47 | $modVars = $variableApi->getAll('ZikulaPermissionsModule'); |
48 | - $modVars['lockadmin'] = (bool)$modVars['lockadmin']; |
|
49 | - $modVars['filter'] = (bool)$modVars['filter']; |
|
48 | + $modVars['lockadmin'] = (bool) $modVars['lockadmin']; |
|
49 | + $modVars['filter'] = (bool) $modVars['filter']; |
|
50 | 50 | |
51 | 51 | $form = $this->createForm(ConfigType::class, $modVars); |
52 | 52 | $form->handleRequest($request); |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | |
57 | 57 | $error = false; |
58 | 58 | |
59 | - $lockadmin = isset($formData['lockadmin']) ? (bool)$formData['lockadmin'] : false; |
|
59 | + $lockadmin = isset($formData['lockadmin']) ? (bool) $formData['lockadmin'] : false; |
|
60 | 60 | $variableApi->set('ZikulaPermissionsModule', 'lockadmin', $lockadmin); |
61 | 61 | |
62 | - $adminId = isset($formData['adminid']) ? (int)$formData['adminid'] : 1; |
|
62 | + $adminId = isset($formData['adminid']) ? (int) $formData['adminid'] : 1; |
|
63 | 63 | if (0 !== $adminId) { |
64 | 64 | $perm = $permissionRepository->find($adminId); |
65 | 65 | if (!$perm) { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | } |
70 | 70 | $variableApi->set('ZikulaPermissionsModule', 'adminid', $adminId); |
71 | 71 | |
72 | - $filter = isset($formData['filter']) ? (bool)$formData['filter'] : false; |
|
72 | + $filter = isset($formData['filter']) ? (bool) $formData['filter'] : false; |
|
73 | 73 | $variableApi->set('ZikulaPermissionsModule', 'filter', $filter); |
74 | 74 | |
75 | 75 | if (true === $error) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $messageModules = $messageModuleCollector->getKeys(); |
59 | 59 | |
60 | 60 | $variables = $variableApi->getAll(VariableApi::CONFIG); |
61 | - $variables['UseCompression'] = (bool)$variables['UseCompression']; |
|
61 | + $variables['UseCompression'] = (bool) $variables['UseCompression']; |
|
62 | 62 | $form = $this->createForm( |
63 | 63 | MainSettingsType::class, |
64 | 64 | $variables, |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | $form = $this->createForm( |
109 | 109 | LocaleSettingsType::class, |
110 | 110 | [ |
111 | - 'multilingual' => (bool)$variableApi->getSystemVar('multilingual'), |
|
111 | + 'multilingual' => (bool) $variableApi->getSystemVar('multilingual'), |
|
112 | 112 | 'languageurl' => $variableApi->getSystemVar('languageurl'), |
113 | - 'language_detect' => (bool)$variableApi->getSystemVar('language_detect'), |
|
113 | + 'language_detect' => (bool) $variableApi->getSystemVar('language_detect'), |
|
114 | 114 | 'locale' => $variableApi->getSystemVar('locale'), |
115 | 115 | 'timezone' => $variableApi->getSystemVar('timezone'), |
116 | 116 | ], |