Completed
Push — master ( f820aa...e4de0d )
by Thomas
12s
created
lib/SecurityConfig.php 1 patch
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -29,137 +29,137 @@
 block discarded – undo
29 29
  */
30 30
 class SecurityConfig {
31 31
 
32
-	/** @var IConfig */
33
-	private $config;
32
+    /** @var IConfig */
33
+    private $config;
34 34
 
35
-	/**
36
-	 * Config constructor.
37
-	 *
38
-	 * @param IConfig $config
39
-	 */
40
-	public function __construct(IConfig $config) {
41
-		$this->config = $config;
42
-	}
35
+    /**
36
+     * Config constructor.
37
+     *
38
+     * @param IConfig $config
39
+     */
40
+    public function __construct(IConfig $config) {
41
+        $this->config = $config;
42
+    }
43 43
 
44
-	/**
45
-	 * is brute force protection enabled
46
-	 *
47
-	 * @return array
48
-	 */
49
-	public function getAllSecurityConfigs() {
50
-		return [
51
-			'isBruteForceProtectionEnabled' => $this->getIsBruteForceProtectionEnabled(),
52
-			'minPasswordLength' => $this->getMinPasswordLength(),
53
-			'isUpperLowerCaseEnforced' => $this->getIsUpperLowerCaseEnforced(),
54
-			'isNumericalCharsEnforced' => $this->getIsNumericCharactersEnforced(),
55
-			'isSpecialCharsEnforced' => $this->getIsSpecialCharactersEnforced()
56
-		];
57
-	}
44
+    /**
45
+     * is brute force protection enabled
46
+     *
47
+     * @return array
48
+     */
49
+    public function getAllSecurityConfigs() {
50
+        return [
51
+            'isBruteForceProtectionEnabled' => $this->getIsBruteForceProtectionEnabled(),
52
+            'minPasswordLength' => $this->getMinPasswordLength(),
53
+            'isUpperLowerCaseEnforced' => $this->getIsUpperLowerCaseEnforced(),
54
+            'isNumericalCharsEnforced' => $this->getIsNumericCharactersEnforced(),
55
+            'isSpecialCharsEnforced' => $this->getIsSpecialCharactersEnforced()
56
+        ];
57
+    }
58 58
 
59
-	/**
60
-	 * is brute force protection enabled
61
-	 *
62
-	 * @return bool
63
-	 */
64
-	public function getIsBruteForceProtectionEnabled() {
65
-		$enableBruteForceProtection = $this->config->getAppValue(
66
-			'security',
67
-			'enable_brute_force_protection',
68
-			'0'
69
-		);
70
-		return boolval($enableBruteForceProtection);
71
-	}
59
+    /**
60
+     * is brute force protection enabled
61
+     *
62
+     * @return bool
63
+     */
64
+    public function getIsBruteForceProtectionEnabled() {
65
+        $enableBruteForceProtection = $this->config->getAppValue(
66
+            'security',
67
+            'enable_brute_force_protection',
68
+            '0'
69
+        );
70
+        return boolval($enableBruteForceProtection);
71
+    }
72 72
 
73
-	/**
74
-	 * get the enforced minimum length of passwords
75
-	 *
76
-	 * @return int
77
-	 */
78
-	public function getMinPasswordLength() {
79
-		$minLength = $this->config->getAppValue('security', 'min_password_length', '8');
80
-		return intval($minLength);
81
-	}
82
-	/**
83
-	 * does the password need to contain upper and lower case characters
84
-	 *
85
-	 * @return bool
86
-	 */
87
-	public function getIsUpperLowerCaseEnforced() {
88
-		$enforceUpperLowerCase = $this->config->getAppValue(
89
-			'security',
90
-			'enforce_upper_lower_case',
91
-			'0'
92
-		);
93
-		return boolval($enforceUpperLowerCase);
94
-	}
95
-	/**
96
-	 * does the password need to contain numeric characters
97
-	 *
98
-	 * @return bool
99
-	 */
100
-	public function getIsNumericCharactersEnforced() {
101
-		$enforceNumericCharacters = $this->config->getAppValue(
102
-			'security',
103
-			'enforce_numeric_characters',
104
-			'0'
105
-		);
106
-		return boolval($enforceNumericCharacters);
107
-	}
108
-	/**
109
-	 * does the password need to contain special characters
110
-	 *
111
-	 * @return bool
112
-	 */
113
-	public function getIsSpecialCharactersEnforced() {
114
-		$enforceSpecialCharacters = $this->config->getAppValue(
115
-			'security',
116
-			'enforce_special_characters',
117
-			'0'
118
-		);
119
-		return boolval($enforceSpecialCharacters);
120
-	}
121
-	/**
122
-	 * enable brute force protection
123
-	 *
124
-	 * @param bool $enableBruteForceProtection
125
-	 */
126
-	public function setIsBruteForceProtectionEnabled($enableBruteForceProtection) {
127
-		$value = $enableBruteForceProtection === true ? '1' : '0';
128
-		$this->config->setAppValue('security', 'enable_brute_force_protection', $value);
129
-	}
130
-	/**
131
-	 * set minimal length of passwords
132
-	 *
133
-	 * @param int $minLength
134
-	 */
135
-	public function setMinPasswordLength($minLength) {
136
-		$this->config->setAppValue('security', 'min_password_length', $minLength);
137
-	}
138
-	/**
139
-	 * enforce upper and lower characters case
140
-	 *
141
-	 * @param bool $enforceUpperLowerCase
142
-	 */
143
-	public function setIsUpperLowerCaseEnforced($enforceUpperLowerCase) {
144
-		$value = $enforceUpperLowerCase === true ? '1' : '0';
145
-		$this->config->setAppValue('security', 'enforce_upper_lower_case', $value);
146
-	}
147
-	/**
148
-	 * enforce numeric characters
149
-	 *
150
-	 * @param bool $enforceNumericCharacters
151
-	 */
152
-	public function setIsNumericCharactersEnforced($enforceNumericCharacters) {
153
-		$value = $enforceNumericCharacters === true ? '1' : '0';
154
-		$this->config->setAppValue('security', 'enforce_numeric_characters', $value);
155
-	}
156
-	/**
157
-	 * enforce special characters
158
-	 *
159
-	 * @param bool $enforceSpecialCharacters
160
-	 */
161
-	public function setIsSpecialCharactersEnforced($enforceSpecialCharacters) {
162
-		$value = $enforceSpecialCharacters === true ? '1' : '0';
163
-		$this->config->setAppValue('security', 'enforce_special_characters', $value);
164
-	}
73
+    /**
74
+     * get the enforced minimum length of passwords
75
+     *
76
+     * @return int
77
+     */
78
+    public function getMinPasswordLength() {
79
+        $minLength = $this->config->getAppValue('security', 'min_password_length', '8');
80
+        return intval($minLength);
81
+    }
82
+    /**
83
+     * does the password need to contain upper and lower case characters
84
+     *
85
+     * @return bool
86
+     */
87
+    public function getIsUpperLowerCaseEnforced() {
88
+        $enforceUpperLowerCase = $this->config->getAppValue(
89
+            'security',
90
+            'enforce_upper_lower_case',
91
+            '0'
92
+        );
93
+        return boolval($enforceUpperLowerCase);
94
+    }
95
+    /**
96
+     * does the password need to contain numeric characters
97
+     *
98
+     * @return bool
99
+     */
100
+    public function getIsNumericCharactersEnforced() {
101
+        $enforceNumericCharacters = $this->config->getAppValue(
102
+            'security',
103
+            'enforce_numeric_characters',
104
+            '0'
105
+        );
106
+        return boolval($enforceNumericCharacters);
107
+    }
108
+    /**
109
+     * does the password need to contain special characters
110
+     *
111
+     * @return bool
112
+     */
113
+    public function getIsSpecialCharactersEnforced() {
114
+        $enforceSpecialCharacters = $this->config->getAppValue(
115
+            'security',
116
+            'enforce_special_characters',
117
+            '0'
118
+        );
119
+        return boolval($enforceSpecialCharacters);
120
+    }
121
+    /**
122
+     * enable brute force protection
123
+     *
124
+     * @param bool $enableBruteForceProtection
125
+     */
126
+    public function setIsBruteForceProtectionEnabled($enableBruteForceProtection) {
127
+        $value = $enableBruteForceProtection === true ? '1' : '0';
128
+        $this->config->setAppValue('security', 'enable_brute_force_protection', $value);
129
+    }
130
+    /**
131
+     * set minimal length of passwords
132
+     *
133
+     * @param int $minLength
134
+     */
135
+    public function setMinPasswordLength($minLength) {
136
+        $this->config->setAppValue('security', 'min_password_length', $minLength);
137
+    }
138
+    /**
139
+     * enforce upper and lower characters case
140
+     *
141
+     * @param bool $enforceUpperLowerCase
142
+     */
143
+    public function setIsUpperLowerCaseEnforced($enforceUpperLowerCase) {
144
+        $value = $enforceUpperLowerCase === true ? '1' : '0';
145
+        $this->config->setAppValue('security', 'enforce_upper_lower_case', $value);
146
+    }
147
+    /**
148
+     * enforce numeric characters
149
+     *
150
+     * @param bool $enforceNumericCharacters
151
+     */
152
+    public function setIsNumericCharactersEnforced($enforceNumericCharacters) {
153
+        $value = $enforceNumericCharacters === true ? '1' : '0';
154
+        $this->config->setAppValue('security', 'enforce_numeric_characters', $value);
155
+    }
156
+    /**
157
+     * enforce special characters
158
+     *
159
+     * @param bool $enforceSpecialCharacters
160
+     */
161
+    public function setIsSpecialCharactersEnforced($enforceSpecialCharacters) {
162
+        $value = $enforceSpecialCharacters === true ? '1' : '0';
163
+        $this->config->setAppValue('security', 'enforce_special_characters', $value);
164
+    }
165 165
 }
166 166
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Db/DbService.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
-
4 3
  *
5 4
  * @author Semih Serhat Karakaya
6 5
  * @copyright Copyright (c) 2017, ownCloud GmbH
Please login to merge, or discard this patch.
lib/Hooks.php 1 patch
Indentation   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
-
4 3
  *
5 4
  * @author Semih Serhat Karakaya
6 5
  * @copyright Copyright (c) 2016, ITU IT HEAD OFFICE.
@@ -45,15 +44,15 @@  discard block
 block discarded – undo
45 44
 
46 45
     /** @var PasswordValidator */
47 46
     private $passValidator;
48
-	/** @var EventDispatcherInterface */
49
-	private $dispatcher;
47
+    /** @var EventDispatcherInterface */
48
+    private $dispatcher;
50 49
 
51 50
     /**
52 51
      * @param IUserManager $userManager
53 52
      * @param Throttle $throttle
54 53
      * @param IRequest $request
55
-	 * @param PasswordValidator $passValidator
56
-	 * @param EventDispatcherInterface $dispatcher
54
+     * @param PasswordValidator $passValidator
55
+     * @param EventDispatcherInterface $dispatcher
57 56
      */
58 57
     public function __construct($userManager, $throttle, $request, $passValidator, $dispatcher){
59 58
         $this->userManager = $userManager;
@@ -73,9 +72,9 @@  discard block
 block discarded – undo
73 72
             $this->postLoginCallback($user);
74 73
         });
75 74
 
76
-		$this->dispatcher->addListener('OCP\User::validatePassword', function(GenericEvent $event) {
77
-			$this->passValidator->validate($event->getArgument('password'));
78
-		});
75
+        $this->dispatcher->addListener('OCP\User::validatePassword', function(GenericEvent $event) {
76
+            $this->passValidator->validate($event->getArgument('password'));
77
+        });
79 78
 
80 79
     }
81 80
 
Please login to merge, or discard this patch.