Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/password_policy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonas Rittershofer <jotoeri@users.noreply.github.com>2021-03-17 21:35:16 +0300
committerJonas Rittershofer <jotoeri@users.noreply.github.com>2021-03-17 21:49:01 +0300
commit3e6f2be151579c4d8db849c919539dad18b6b62a (patch)
tree4eca5614715fe2c013cd4e2583e984b9f8bda57a /lib
parent8c24c43cec835124438a9ee9779beafb16593f97 (diff)
Run CS-Fix
Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/AppInfo/Application.php1
-rw-r--r--lib/Capabilities.php1
-rw-r--r--lib/Compliance/Expiration.php10
-rw-r--r--lib/Compliance/HistoryCompliance.php4
-rw-r--r--lib/Compliance/IAuditor.php1
-rw-r--r--lib/Compliance/IEntryControl.php2
-rw-r--r--lib/Compliance/IUpdatable.php1
-rw-r--r--lib/ComplianceService.php5
-rw-r--r--lib/Controller/APIController.php1
-rw-r--r--lib/FailedLoginCompliance.php1
-rw-r--r--lib/Generator.php1
-rw-r--r--lib/Listener/BeforePasswordUpdatedEventListener.php3
-rw-r--r--lib/Listener/BeforeUserLoggedInEventListener.php3
-rw-r--r--lib/Listener/FailedLoginListener.php1
-rw-r--r--lib/Listener/GenerateSecurePasswordEventListener.php1
-rw-r--r--lib/Listener/PasswordUpdatedEventListener.php3
-rw-r--r--lib/Listener/SuccesfullLoginListener.php1
-rw-r--r--lib/Listener/ValidatePasswordPolicyEventListener.php1
-rw-r--r--lib/PasswordPolicyConfig.php2
-rw-r--r--lib/PasswordValidator.php2
-rw-r--r--lib/Settings.php1
-rw-r--r--lib/Validator/CommonPasswordsValidator.php4
-rw-r--r--lib/Validator/HIBPValidator.php2
-rw-r--r--lib/Validator/IValidator.php1
-rw-r--r--lib/Validator/LengthValidator.php4
-rw-r--r--lib/Validator/NumericCharacterValidator.php4
-rw-r--r--lib/Validator/SpecialCharactersValidator.php4
-rw-r--r--lib/Validator/UpperCaseLoweCaseValidator.php4
28 files changed, 43 insertions, 26 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index e2ab5fb..bdbd1a9 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/Capabilities.php b/lib/Capabilities.php
index 7eb2466..55c9920 100644
--- a/lib/Capabilities.php
+++ b/lib/Capabilities.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Bjoern Schiessle <bjoern@schiessle.org>
diff --git a/lib/Compliance/Expiration.php b/lib/Compliance/Expiration.php
index 50b97d2..6ffd675 100644
--- a/lib/Compliance/Expiration.php
+++ b/lib/Compliance/Expiration.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
@@ -64,10 +65,10 @@ class Expiration implements IUpdatable, IEntryControl {
* @throws PreConditionNotMetException
*/
public function update(IUser $user, string $password): void {
- if(!$this->isLocalUser($user)) {
+ if (!$this->isLocalUser($user)) {
return;
}
- if($this->policyConfig->getExpiryInDays() === 0) {
+ if ($this->policyConfig->getExpiryInDays() === 0) {
$this->config->deleteUserValue(
$user->getUID(),
'password_policy',
@@ -84,7 +85,7 @@ class Expiration implements IUpdatable, IEntryControl {
}
public function entryControl(IUser $user, string $password): void {
- if($this->policyConfig->getExpiryInDays() !== 0
+ if ($this->policyConfig->getExpiryInDays() !== 0
&& $this->isLocalUser($user)
&& $this->isPasswordExpired($user)
) {
@@ -102,7 +103,7 @@ class Expiration implements IUpdatable, IEntryControl {
0
);
- if($updatedAt === 0) {
+ if ($updatedAt === 0) {
$this->update($user, '');
return false;
}
@@ -117,5 +118,4 @@ class Expiration implements IUpdatable, IEntryControl {
$localBackends = ['Database', 'Guests'];
return in_array($user->getBackendClassName(), $localBackends);
}
-
}
diff --git a/lib/Compliance/HistoryCompliance.php b/lib/Compliance/HistoryCompliance.php
index cea7b99..af437a2 100644
--- a/lib/Compliance/HistoryCompliance.php
+++ b/lib/Compliance/HistoryCompliance.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
@@ -93,7 +94,7 @@ class HistoryCompliance implements IAuditor, IUpdatable {
*/
public function update(IUser $user, string $password): void {
$historySize = $this->policyConfig->getHistorySize();
- if($historySize === 0) {
+ if ($historySize === 0) {
$this->config->deleteUserValue($user->getUID(), 'password_policy', 'passwordHistory');
return;
}
@@ -129,5 +130,4 @@ class HistoryCompliance implements IAuditor, IUpdatable {
return $history;
}
-
}
diff --git a/lib/Compliance/IAuditor.php b/lib/Compliance/IAuditor.php
index c11eb15..0d56829 100644
--- a/lib/Compliance/IAuditor.php
+++ b/lib/Compliance/IAuditor.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
diff --git a/lib/Compliance/IEntryControl.php b/lib/Compliance/IEntryControl.php
index 0df1cd4..6571269 100644
--- a/lib/Compliance/IEntryControl.php
+++ b/lib/Compliance/IEntryControl.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
@@ -24,7 +25,6 @@ declare(strict_types=1);
namespace OCA\Password_Policy\Compliance;
-
use OC\HintException;
use OCP\IUser;
diff --git a/lib/Compliance/IUpdatable.php b/lib/Compliance/IUpdatable.php
index 9c64ce5..accf9e4 100644
--- a/lib/Compliance/IUpdatable.php
+++ b/lib/Compliance/IUpdatable.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
diff --git a/lib/ComplianceService.php b/lib/ComplianceService.php
index 88d9400..d54defc 100644
--- a/lib/ComplianceService.php
+++ b/lib/ComplianceService.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
@@ -88,7 +89,7 @@ class ComplianceService {
//public function entryControl(IUser $user, string $password, bool $isTokenLogin) {
public function entryControl(string $loginName, string $password) {
$uid = $loginName;
- \OCP\Util::emitHook( '\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', ['uid' => &$uid]);
+ \OCP\Util::emitHook('\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', ['uid' => &$uid]);
foreach ($this->getInstance(IEntryControl::class) as $instance) {
try {
$user = \OC::$server->getUserManager()->get($uid);
@@ -111,7 +112,7 @@ class ComplianceService {
foreach (self::COMPLIANCERS as $compliance) {
try {
$instance = $this->container->query($compliance);
- if(!$instance instanceof $interface) {
+ if (!$instance instanceof $interface) {
continue;
}
} catch (QueryException $e) {
diff --git a/lib/Controller/APIController.php b/lib/Controller/APIController.php
index ce0ae0e..28ba0f5 100644
--- a/lib/Controller/APIController.php
+++ b/lib/Controller/APIController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/FailedLoginCompliance.php b/lib/FailedLoginCompliance.php
index 8002b17..4f4b561 100644
--- a/lib/FailedLoginCompliance.php
+++ b/lib/FailedLoginCompliance.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/Generator.php b/lib/Generator.php
index 0bb6171..1328054 100644
--- a/lib/Generator.php
+++ b/lib/Generator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/Listener/BeforePasswordUpdatedEventListener.php b/lib/Listener/BeforePasswordUpdatedEventListener.php
index e54bec9..06e5d95 100644
--- a/lib/Listener/BeforePasswordUpdatedEventListener.php
+++ b/lib/Listener/BeforePasswordUpdatedEventListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Morris Jobke <hey@morrisjobke.de>
@@ -38,7 +39,7 @@ class BeforePasswordUpdatedEventListener implements IEventListener {
}
public function handle(Event $event): void {
- if(!($event instanceof BeforePasswordUpdatedEvent)) {
+ if (!($event instanceof BeforePasswordUpdatedEvent)) {
return;
}
$this->complianceUpdater->audit($event->getUser(), $event->getPassword());
diff --git a/lib/Listener/BeforeUserLoggedInEventListener.php b/lib/Listener/BeforeUserLoggedInEventListener.php
index 3544b35..b92fa99 100644
--- a/lib/Listener/BeforeUserLoggedInEventListener.php
+++ b/lib/Listener/BeforeUserLoggedInEventListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Morris Jobke <hey@morrisjobke.de>
@@ -38,7 +39,7 @@ class BeforeUserLoggedInEventListener implements IEventListener {
}
public function handle(Event $event): void {
- if(!$event instanceof BeforeUserLoggedInEvent) {
+ if (!$event instanceof BeforeUserLoggedInEvent) {
return;
}
$this->complianceUpdater->entryControl($event->getUsername(), $event->getPassword());
diff --git a/lib/Listener/FailedLoginListener.php b/lib/Listener/FailedLoginListener.php
index 87def7a..a839fe4 100644
--- a/lib/Listener/FailedLoginListener.php
+++ b/lib/Listener/FailedLoginListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/Listener/GenerateSecurePasswordEventListener.php b/lib/Listener/GenerateSecurePasswordEventListener.php
index b88f32c..f153365 100644
--- a/lib/Listener/GenerateSecurePasswordEventListener.php
+++ b/lib/Listener/GenerateSecurePasswordEventListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Morris Jobke <hey@morrisjobke.de>
diff --git a/lib/Listener/PasswordUpdatedEventListener.php b/lib/Listener/PasswordUpdatedEventListener.php
index e4ae863..75cc55b 100644
--- a/lib/Listener/PasswordUpdatedEventListener.php
+++ b/lib/Listener/PasswordUpdatedEventListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Morris Jobke <hey@morrisjobke.de>
@@ -38,7 +39,7 @@ class PasswordUpdatedEventListener implements IEventListener {
}
public function handle(Event $event): void {
- if(!($event instanceof PasswordUpdatedEvent)) {
+ if (!($event instanceof PasswordUpdatedEvent)) {
return;
}
$this->complianceUpdater->update($event->getUser(), $event->getPassword());
diff --git a/lib/Listener/SuccesfullLoginListener.php b/lib/Listener/SuccesfullLoginListener.php
index f8b42ed..8e017e3 100644
--- a/lib/Listener/SuccesfullLoginListener.php
+++ b/lib/Listener/SuccesfullLoginListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/Listener/ValidatePasswordPolicyEventListener.php b/lib/Listener/ValidatePasswordPolicyEventListener.php
index 5596528..2a15939 100644
--- a/lib/Listener/ValidatePasswordPolicyEventListener.php
+++ b/lib/Listener/ValidatePasswordPolicyEventListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Morris Jobke <hey@morrisjobke.de>
diff --git a/lib/PasswordPolicyConfig.php b/lib/PasswordPolicyConfig.php
index a86ab1a..e13f87a 100644
--- a/lib/PasswordPolicyConfig.php
+++ b/lib/PasswordPolicyConfig.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
@@ -23,7 +24,6 @@ declare(strict_types=1);
namespace OCA\Password_Policy;
-
use OCP\IConfig;
/**
diff --git a/lib/PasswordValidator.php b/lib/PasswordValidator.php
index 6c79128..0493de0 100644
--- a/lib/PasswordValidator.php
+++ b/lib/PasswordValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
@@ -23,7 +24,6 @@ declare(strict_types=1);
namespace OCA\Password_Policy;
-
use OC\HintException;
use OCA\Password_Policy\Validator\CommonPasswordsValidator;
use OCA\Password_Policy\Validator\HIBPValidator;
diff --git a/lib/Settings.php b/lib/Settings.php
index 7ae59e3..3bd8f3c 100644
--- a/lib/Settings.php
+++ b/lib/Settings.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/Validator/CommonPasswordsValidator.php b/lib/Validator/CommonPasswordsValidator.php
index f0942bd..e3952c0 100644
--- a/lib/Validator/CommonPasswordsValidator.php
+++ b/lib/Validator/CommonPasswordsValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -43,7 +44,7 @@ class CommonPasswordsValidator implements IValidator {
public function validate(string $password): void {
$enforceNonCommonPassword = $this->config->getEnforceNonCommonPassword();
$passwordFile = __DIR__ . '/../../lists/list-'.strlen($password).'.php';
- if($enforceNonCommonPassword && file_exists($passwordFile)) {
+ if ($enforceNonCommonPassword && file_exists($passwordFile)) {
$commonPasswords = require_once $passwordFile;
if (isset($commonPasswords[strtolower($password)])) {
$message = 'Password is among the 1,000,000 most common ones. Please make it unique.';
@@ -54,5 +55,4 @@ class CommonPasswordsValidator implements IValidator {
}
}
}
-
}
diff --git a/lib/Validator/HIBPValidator.php b/lib/Validator/HIBPValidator.php
index 98af187..843bda7 100644
--- a/lib/Validator/HIBPValidator.php
+++ b/lib/Validator/HIBPValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -86,5 +87,4 @@ class HIBPValidator implements IValidator {
}
}
}
-
}
diff --git a/lib/Validator/IValidator.php b/lib/Validator/IValidator.php
index e45e960..f744bc3 100644
--- a/lib/Validator/IValidator.php
+++ b/lib/Validator/IValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
diff --git a/lib/Validator/LengthValidator.php b/lib/Validator/LengthValidator.php
index bf45737..43a07af 100644
--- a/lib/Validator/LengthValidator.php
+++ b/lib/Validator/LengthValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -42,7 +43,7 @@ class LengthValidator implements IValidator {
public function validate(string $password): void {
$minLength = $this->config->getMinLength();
- if(strlen($password) < $minLength) {
+ if (strlen($password) < $minLength) {
$message = 'Password needs to be at least ' . $minLength . ' characters long.';
$message_t = $this->l->t(
'Password needs to be at least %s characters long.', [$minLength]
@@ -50,5 +51,4 @@ class LengthValidator implements IValidator {
throw new HintException($message, $message_t);
}
}
-
}
diff --git a/lib/Validator/NumericCharacterValidator.php b/lib/Validator/NumericCharacterValidator.php
index cc15c88..af0dce2 100644
--- a/lib/Validator/NumericCharacterValidator.php
+++ b/lib/Validator/NumericCharacterValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -42,7 +43,7 @@ class NumericCharacterValidator implements IValidator {
public function validate(string $password): void {
$enforceNumericCharacters = $this->config->getEnforceNumericCharacters();
- if($enforceNumericCharacters) {
+ if ($enforceNumericCharacters) {
if (preg_match('/^(?=.*\d).+$/', $password) !== 1) {
$message = 'Password needs to contain at least one numeric character.';
$message_t = $this->l->t(
@@ -52,5 +53,4 @@ class NumericCharacterValidator implements IValidator {
}
}
}
-
}
diff --git a/lib/Validator/SpecialCharactersValidator.php b/lib/Validator/SpecialCharactersValidator.php
index e6d9478..d4258aa 100644
--- a/lib/Validator/SpecialCharactersValidator.php
+++ b/lib/Validator/SpecialCharactersValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -42,7 +43,7 @@ class SpecialCharactersValidator implements IValidator {
public function validate(string $password): void {
$enforceSpecialCharacters = $this->config->getEnforceSpecialCharacters();
- if($enforceSpecialCharacters && ctype_alnum($password)) {
+ if ($enforceSpecialCharacters && ctype_alnum($password)) {
$message = 'Password needs to contain at least one special character.';
$message_t = $this->l->t(
'Password needs to contain at least one special character.'
@@ -50,5 +51,4 @@ class SpecialCharactersValidator implements IValidator {
throw new HintException($message, $message_t);
}
}
-
}
diff --git a/lib/Validator/UpperCaseLoweCaseValidator.php b/lib/Validator/UpperCaseLoweCaseValidator.php
index 840007c..f4781f3 100644
--- a/lib/Validator/UpperCaseLoweCaseValidator.php
+++ b/lib/Validator/UpperCaseLoweCaseValidator.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -42,7 +43,7 @@ class UpperCaseLoweCaseValidator implements IValidator {
public function validate(string $password): void {
$enforceUpperLowerCase = $this->config->getEnforceUpperLowerCase();
- if($enforceUpperLowerCase) {
+ if ($enforceUpperLowerCase) {
if (preg_match('/^(?=.*[a-z])(?=.*[A-Z]).+$/', $password) !== 1) {
$message = 'Password needs to contain at least one lower and one upper case character.';
$message_t = $this->l->t(
@@ -52,5 +53,4 @@ class UpperCaseLoweCaseValidator implements IValidator {
}
}
}
-
}