Passed
Push — master ( 81e439...32219e )
by Marcel
17:44 queued 12s
created
apps/files_external/lib/Lib/Backend/LegacyBackend.php 2 patches
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,18 +62,18 @@
 block discarded – undo
62 62
 				$placeholder = substr($placeholder, 1);
63 63
 			}
64 64
 			switch ($placeholder[0]) {
65
-			case '!':
66
-				$type = DefinitionParameter::VALUE_BOOLEAN;
67
-				$placeholder = substr($placeholder, 1);
68
-				break;
69
-			case '*':
70
-				$type = DefinitionParameter::VALUE_PASSWORD;
71
-				$placeholder = substr($placeholder, 1);
72
-				break;
73
-			case '#':
74
-				$type = DefinitionParameter::VALUE_HIDDEN;
75
-				$placeholder = substr($placeholder, 1);
76
-				break;
65
+			    case '!':
66
+				    $type = DefinitionParameter::VALUE_BOOLEAN;
67
+				    $placeholder = substr($placeholder, 1);
68
+				    break;
69
+			    case '*':
70
+				    $type = DefinitionParameter::VALUE_PASSWORD;
71
+				    $placeholder = substr($placeholder, 1);
72
+				    break;
73
+			    case '#':
74
+				    $type = DefinitionParameter::VALUE_HIDDEN;
75
+				    $placeholder = substr($placeholder, 1);
76
+				    break;
77 77
 			}
78 78
 			$this->addParameter((new DefinitionParameter($name, $placeholder))
79 79
 				->setType($type)
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -32,72 +32,72 @@
 block discarded – undo
32 32
  * Legacy compatibility for OCA\Files_External\MountConfig::registerBackend()
33 33
  */
34 34
 class LegacyBackend extends Backend {
35
-	use LegacyDependencyCheckPolyfill {
36
-		LegacyDependencyCheckPolyfill::checkDependencies as doCheckDependencies;
37
-	}
35
+    use LegacyDependencyCheckPolyfill {
36
+        LegacyDependencyCheckPolyfill::checkDependencies as doCheckDependencies;
37
+    }
38 38
 
39
-	/** @var bool */
40
-	protected $hasDependencies = false;
39
+    /** @var bool */
40
+    protected $hasDependencies = false;
41 41
 
42
-	/**
43
-	 * @param string $class
44
-	 * @param array $definition
45
-	 * @param Builtin $authMechanism
46
-	 */
47
-	public function __construct($class, array $definition, Builtin $authMechanism) {
48
-		$this
49
-			->setIdentifier($class)
50
-			->setStorageClass($class)
51
-			->setText($definition['backend'])
52
-			->addAuthScheme(Builtin::SCHEME_BUILTIN)
53
-			->setLegacyAuthMechanism($authMechanism)
54
-		;
42
+    /**
43
+     * @param string $class
44
+     * @param array $definition
45
+     * @param Builtin $authMechanism
46
+     */
47
+    public function __construct($class, array $definition, Builtin $authMechanism) {
48
+        $this
49
+            ->setIdentifier($class)
50
+            ->setStorageClass($class)
51
+            ->setText($definition['backend'])
52
+            ->addAuthScheme(Builtin::SCHEME_BUILTIN)
53
+            ->setLegacyAuthMechanism($authMechanism)
54
+        ;
55 55
 
56
-		foreach ($definition['configuration'] as $name => $placeholder) {
57
-			$flags = DefinitionParameter::FLAG_NONE;
58
-			$type = DefinitionParameter::VALUE_TEXT;
59
-			if ($placeholder[0] === '&') {
60
-				$flags = DefinitionParameter::FLAG_OPTIONAL;
61
-				$placeholder = substr($placeholder, 1);
62
-			}
63
-			switch ($placeholder[0]) {
64
-			case '!':
65
-				$type = DefinitionParameter::VALUE_BOOLEAN;
66
-				$placeholder = substr($placeholder, 1);
67
-				break;
68
-			case '*':
69
-				$type = DefinitionParameter::VALUE_PASSWORD;
70
-				$placeholder = substr($placeholder, 1);
71
-				break;
72
-			case '#':
73
-				$type = DefinitionParameter::VALUE_HIDDEN;
74
-				$placeholder = substr($placeholder, 1);
75
-				break;
76
-			}
77
-			$this->addParameter((new DefinitionParameter($name, $placeholder))
78
-				->setType($type)
79
-				->setFlags($flags)
80
-			);
81
-		}
56
+        foreach ($definition['configuration'] as $name => $placeholder) {
57
+            $flags = DefinitionParameter::FLAG_NONE;
58
+            $type = DefinitionParameter::VALUE_TEXT;
59
+            if ($placeholder[0] === '&') {
60
+                $flags = DefinitionParameter::FLAG_OPTIONAL;
61
+                $placeholder = substr($placeholder, 1);
62
+            }
63
+            switch ($placeholder[0]) {
64
+            case '!':
65
+                $type = DefinitionParameter::VALUE_BOOLEAN;
66
+                $placeholder = substr($placeholder, 1);
67
+                break;
68
+            case '*':
69
+                $type = DefinitionParameter::VALUE_PASSWORD;
70
+                $placeholder = substr($placeholder, 1);
71
+                break;
72
+            case '#':
73
+                $type = DefinitionParameter::VALUE_HIDDEN;
74
+                $placeholder = substr($placeholder, 1);
75
+                break;
76
+            }
77
+            $this->addParameter((new DefinitionParameter($name, $placeholder))
78
+                ->setType($type)
79
+                ->setFlags($flags)
80
+            );
81
+        }
82 82
 
83
-		if (isset($definition['priority'])) {
84
-			$this->setPriority($definition['priority']);
85
-		}
86
-		if (isset($definition['custom'])) {
87
-			$this->addCustomJs($definition['custom']);
88
-		}
89
-		if (isset($definition['has_dependencies']) && $definition['has_dependencies']) {
90
-			$this->hasDependencies = true;
91
-		}
92
-	}
83
+        if (isset($definition['priority'])) {
84
+            $this->setPriority($definition['priority']);
85
+        }
86
+        if (isset($definition['custom'])) {
87
+            $this->addCustomJs($definition['custom']);
88
+        }
89
+        if (isset($definition['has_dependencies']) && $definition['has_dependencies']) {
90
+            $this->hasDependencies = true;
91
+        }
92
+    }
93 93
 
94
-	/**
95
-	 * @return MissingDependency[]
96
-	 */
97
-	public function checkDependencies() {
98
-		if ($this->hasDependencies) {
99
-			return $this->doCheckDependencies();
100
-		}
101
-		return [];
102
-	}
94
+    /**
95
+     * @return MissingDependency[]
96
+     */
97
+    public function checkDependencies() {
98
+        if ($this->hasDependencies) {
99
+            return $this->doCheckDependencies();
100
+        }
101
+        return [];
102
+    }
103 103
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Backend/SMB_OC.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,11 +61,11 @@
 block discarded – undo
61 61
 		;
62 62
 	}
63 63
 
64
-	public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
64
+	public function manipulateStorageConfig(StorageConfig & $storage, IUser $user = null) {
65 65
 		$username_as_share = ($storage->getBackendOption('username_as_share') === true);
66 66
 
67 67
 		if ($username_as_share) {
68
-			$share = '/' . $storage->getBackendOption('user');
68
+			$share = '/'.$storage->getBackendOption('user');
69 69
 			$storage->setBackendOption('share', $share);
70 70
 		}
71 71
 	}
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -37,35 +37,35 @@
 block discarded – undo
37 37
  * Deprecated SMB_OC class - use SMB with the password::sessioncredentials auth mechanism
38 38
  */
39 39
 class SMB_OC extends Backend {
40
-	use LegacyDependencyCheckPolyfill;
40
+    use LegacyDependencyCheckPolyfill;
41 41
 
42
-	public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) {
43
-		$this
44
-			->setIdentifier('\OC\Files\Storage\SMB_OC')
45
-			->setStorageClass('\OCA\Files_External\Lib\Storage\SMB')
46
-			->setText($l->t('SMB/CIFS using OC login'))
47
-			->addParameters([
48
-				new DefinitionParameter('host', $l->t('Host')),
49
-				(new DefinitionParameter('username_as_share', $l->t('Username as share')))
50
-					->setType(DefinitionParameter::VALUE_BOOLEAN),
51
-				(new DefinitionParameter('share', $l->t('Share')))
52
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
53
-				(new DefinitionParameter('root', $l->t('Remote subfolder')))
54
-					->setFlag(DefinitionParameter::FLAG_OPTIONAL),
55
-			])
56
-			->setPriority(BackendService::PRIORITY_DEFAULT - 10)
57
-			->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
58
-			->setLegacyAuthMechanism($legacyAuth)
59
-			->deprecateTo($smbBackend)
60
-		;
61
-	}
42
+    public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBackend) {
43
+        $this
44
+            ->setIdentifier('\OC\Files\Storage\SMB_OC')
45
+            ->setStorageClass('\OCA\Files_External\Lib\Storage\SMB')
46
+            ->setText($l->t('SMB/CIFS using OC login'))
47
+            ->addParameters([
48
+                new DefinitionParameter('host', $l->t('Host')),
49
+                (new DefinitionParameter('username_as_share', $l->t('Username as share')))
50
+                    ->setType(DefinitionParameter::VALUE_BOOLEAN),
51
+                (new DefinitionParameter('share', $l->t('Share')))
52
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
53
+                (new DefinitionParameter('root', $l->t('Remote subfolder')))
54
+                    ->setFlag(DefinitionParameter::FLAG_OPTIONAL),
55
+            ])
56
+            ->setPriority(BackendService::PRIORITY_DEFAULT - 10)
57
+            ->addAuthScheme(AuthMechanism::SCHEME_PASSWORD)
58
+            ->setLegacyAuthMechanism($legacyAuth)
59
+            ->deprecateTo($smbBackend)
60
+        ;
61
+    }
62 62
 
63
-	public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
64
-		$username_as_share = ($storage->getBackendOption('username_as_share') === true);
63
+    public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
64
+        $username_as_share = ($storage->getBackendOption('username_as_share') === true);
65 65
 
66
-		if ($username_as_share) {
67
-			$share = '/' . $storage->getBackendOption('user');
68
-			$storage->setBackendOption('share', $share);
69
-		}
70
-	}
66
+        if ($username_as_share) {
67
+            $share = '/' . $storage->getBackendOption('user');
68
+            $storage->setBackendOption('share', $share);
69
+        }
70
+    }
71 71
 }
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/DependencyTrait.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@
 block discarded – undo
29 29
  */
30 30
 trait DependencyTrait {
31 31
 
32
-	/**
33
-	 * Check if object is valid for use
34
-	 *
35
-	 * @return MissingDependency[] Unsatisfied dependencies
36
-	 */
37
-	public function checkDependencies() {
38
-		return []; // no dependencies by default
39
-	}
32
+    /**
33
+     * Check if object is valid for use
34
+     *
35
+     * @return MissingDependency[] Unsatisfied dependencies
36
+     */
37
+    public function checkDependencies() {
38
+        return []; // no dependencies by default
39
+    }
40 40
 
41 41
 }
42 42
 
Please login to merge, or discard this patch.
apps/systemtags/lib/Activity/Setting.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class Setting implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'systemtags';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'systemtags';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('<strong>System tags</strong> for a file have been modified');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('<strong>System tags</strong> for a file have been modified');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 50;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 50;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
apps/files_sharing/lib/External/Watcher.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@
 block discarded – undo
23 23
 namespace OCA\Files_Sharing\External;
24 24
 
25 25
 class Watcher extends \OC\Files\Cache\Watcher {
26
-	/**
27
-	 * remove deleted files in $path from the cache
28
-	 *
29
-	 * @param string $path
30
-	 */
31
-	public function cleanFolder($path) {
32
-		// not needed, the scanner takes care of this
33
-	}
26
+    /**
27
+     * remove deleted files in $path from the cache
28
+     *
29
+     * @param string $path
30
+     */
31
+    public function cleanFolder($path) {
32
+        // not needed, the scanner takes care of this
33
+    }
34 34
 }
Please login to merge, or discard this patch.
apps/twofactor_backupcodes/lib/Db/BackupCode.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@
 block discarded – undo
34 34
  */
35 35
 class BackupCode extends Entity {
36 36
 
37
-	/** @var string */
38
-	protected $userId;
37
+    /** @var string */
38
+    protected $userId;
39 39
 
40
-	/** @var string */
41
-	protected $code;
40
+    /** @var string */
41
+    protected $code;
42 42
 
43
-	/** @var int */
44
-	protected $used;
43
+    /** @var int */
44
+    protected $used;
45 45
 
46 46
 }
Please login to merge, or discard this patch.
apps/encryption/lib/Controller/SettingsController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
 				$encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid);
129 129
 				$header = $this->crypt->generateHeader();
130 130
 				if ($encryptedKey) {
131
-					$this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
131
+					$this->keyManager->setPrivateKey($uid, $header.$encryptedKey);
132 132
 					$this->session->setPrivateKey($decryptedKey);
133 133
 					$result = true;
134 134
 				}
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -38,128 +38,128 @@
 block discarded – undo
38 38
 
39 39
 class SettingsController extends Controller {
40 40
 
41
-	/** @var IL10N */
42
-	private $l;
43
-
44
-	/** @var IUserManager */
45
-	private $userManager;
46
-
47
-	/** @var IUserSession */
48
-	private $userSession;
49
-
50
-	/** @var KeyManager */
51
-	private $keyManager;
52
-
53
-	/** @var Crypt */
54
-	private $crypt;
55
-
56
-	/** @var Session */
57
-	private $session;
58
-
59
-	/** @var ISession  */
60
-	private $ocSession;
61
-
62
-	/** @var  Util */
63
-	private $util;
64
-
65
-	/**
66
-	 * @param string $AppName
67
-	 * @param IRequest $request
68
-	 * @param IL10N $l10n
69
-	 * @param IUserManager $userManager
70
-	 * @param IUserSession $userSession
71
-	 * @param KeyManager $keyManager
72
-	 * @param Crypt $crypt
73
-	 * @param Session $session
74
-	 * @param ISession $ocSession
75
-	 * @param Util $util
76
-	 */
77
-	public function __construct($AppName,
78
-								IRequest $request,
79
-								IL10N $l10n,
80
-								IUserManager $userManager,
81
-								IUserSession $userSession,
82
-								KeyManager $keyManager,
83
-								Crypt $crypt,
84
-								Session $session,
85
-								ISession $ocSession,
86
-								Util $util
41
+    /** @var IL10N */
42
+    private $l;
43
+
44
+    /** @var IUserManager */
45
+    private $userManager;
46
+
47
+    /** @var IUserSession */
48
+    private $userSession;
49
+
50
+    /** @var KeyManager */
51
+    private $keyManager;
52
+
53
+    /** @var Crypt */
54
+    private $crypt;
55
+
56
+    /** @var Session */
57
+    private $session;
58
+
59
+    /** @var ISession  */
60
+    private $ocSession;
61
+
62
+    /** @var  Util */
63
+    private $util;
64
+
65
+    /**
66
+     * @param string $AppName
67
+     * @param IRequest $request
68
+     * @param IL10N $l10n
69
+     * @param IUserManager $userManager
70
+     * @param IUserSession $userSession
71
+     * @param KeyManager $keyManager
72
+     * @param Crypt $crypt
73
+     * @param Session $session
74
+     * @param ISession $ocSession
75
+     * @param Util $util
76
+     */
77
+    public function __construct($AppName,
78
+                                IRequest $request,
79
+                                IL10N $l10n,
80
+                                IUserManager $userManager,
81
+                                IUserSession $userSession,
82
+                                KeyManager $keyManager,
83
+                                Crypt $crypt,
84
+                                Session $session,
85
+                                ISession $ocSession,
86
+                                Util $util
87 87
 ) {
88
-		parent::__construct($AppName, $request);
89
-		$this->l = $l10n;
90
-		$this->userSession = $userSession;
91
-		$this->userManager = $userManager;
92
-		$this->keyManager = $keyManager;
93
-		$this->crypt = $crypt;
94
-		$this->session = $session;
95
-		$this->ocSession = $ocSession;
96
-		$this->util = $util;
97
-	}
98
-
99
-
100
-	/**
101
-	 * @NoAdminRequired
102
-	 * @UseSession
103
-	 *
104
-	 * @param string $oldPassword
105
-	 * @param string $newPassword
106
-	 * @return DataResponse
107
-	 */
108
-	public function updatePrivateKeyPassword($oldPassword, $newPassword) {
109
-		$result = false;
110
-		$uid = $this->userSession->getUser()->getUID();
111
-		$errorMessage = $this->l->t('Could not update the private key password.');
112
-
113
-		//check if password is correct
114
-		$passwordCorrect = $this->userManager->checkPassword($uid, $newPassword);
115
-		if ($passwordCorrect === false) {
116
-			// if check with uid fails we need to check the password with the login name
117
-			// e.g. in the ldap case. For local user we need to check the password with
118
-			// the uid because in this case the login name is case insensitive
119
-			$loginName = $this->ocSession->get('loginname');
120
-			$passwordCorrect = $this->userManager->checkPassword($loginName, $newPassword);
121
-		}
122
-
123
-		if ($passwordCorrect !== false) {
124
-			$encryptedKey = $this->keyManager->getPrivateKey($uid);
125
-			$decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword, $uid);
126
-
127
-			if ($decryptedKey) {
128
-				$encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid);
129
-				$header = $this->crypt->generateHeader();
130
-				if ($encryptedKey) {
131
-					$this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
132
-					$this->session->setPrivateKey($decryptedKey);
133
-					$result = true;
134
-				}
135
-			} else {
136
-				$errorMessage = $this->l->t('The old password was not correct, please try again.');
137
-			}
138
-		} else {
139
-			$errorMessage = $this->l->t('The current log-in password was not correct, please try again.');
140
-		}
141
-
142
-		if ($result === true) {
143
-			$this->session->setStatus(Session::INIT_SUCCESSFUL);
144
-			return new DataResponse(
145
-				['message' => $this->l->t('Private key password successfully updated.')]
146
-			);
147
-		} else {
148
-			return new DataResponse(
149
-				['message' => $errorMessage],
150
-				Http::STATUS_BAD_REQUEST
151
-			);
152
-		}
153
-	}
154
-
155
-	/**
156
-	 * @UseSession
157
-	 *
158
-	 * @param bool $encryptHomeStorage
159
-	 * @return DataResponse
160
-	 */
161
-	public function setEncryptHomeStorage($encryptHomeStorage) {
162
-		$this->util->setEncryptHomeStorage($encryptHomeStorage);
163
-		return new DataResponse();
164
-	}
88
+        parent::__construct($AppName, $request);
89
+        $this->l = $l10n;
90
+        $this->userSession = $userSession;
91
+        $this->userManager = $userManager;
92
+        $this->keyManager = $keyManager;
93
+        $this->crypt = $crypt;
94
+        $this->session = $session;
95
+        $this->ocSession = $ocSession;
96
+        $this->util = $util;
97
+    }
98
+
99
+
100
+    /**
101
+     * @NoAdminRequired
102
+     * @UseSession
103
+     *
104
+     * @param string $oldPassword
105
+     * @param string $newPassword
106
+     * @return DataResponse
107
+     */
108
+    public function updatePrivateKeyPassword($oldPassword, $newPassword) {
109
+        $result = false;
110
+        $uid = $this->userSession->getUser()->getUID();
111
+        $errorMessage = $this->l->t('Could not update the private key password.');
112
+
113
+        //check if password is correct
114
+        $passwordCorrect = $this->userManager->checkPassword($uid, $newPassword);
115
+        if ($passwordCorrect === false) {
116
+            // if check with uid fails we need to check the password with the login name
117
+            // e.g. in the ldap case. For local user we need to check the password with
118
+            // the uid because in this case the login name is case insensitive
119
+            $loginName = $this->ocSession->get('loginname');
120
+            $passwordCorrect = $this->userManager->checkPassword($loginName, $newPassword);
121
+        }
122
+
123
+        if ($passwordCorrect !== false) {
124
+            $encryptedKey = $this->keyManager->getPrivateKey($uid);
125
+            $decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword, $uid);
126
+
127
+            if ($decryptedKey) {
128
+                $encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid);
129
+                $header = $this->crypt->generateHeader();
130
+                if ($encryptedKey) {
131
+                    $this->keyManager->setPrivateKey($uid, $header . $encryptedKey);
132
+                    $this->session->setPrivateKey($decryptedKey);
133
+                    $result = true;
134
+                }
135
+            } else {
136
+                $errorMessage = $this->l->t('The old password was not correct, please try again.');
137
+            }
138
+        } else {
139
+            $errorMessage = $this->l->t('The current log-in password was not correct, please try again.');
140
+        }
141
+
142
+        if ($result === true) {
143
+            $this->session->setStatus(Session::INIT_SUCCESSFUL);
144
+            return new DataResponse(
145
+                ['message' => $this->l->t('Private key password successfully updated.')]
146
+            );
147
+        } else {
148
+            return new DataResponse(
149
+                ['message' => $errorMessage],
150
+                Http::STATUS_BAD_REQUEST
151
+            );
152
+        }
153
+    }
154
+
155
+    /**
156
+     * @UseSession
157
+     *
158
+     * @param bool $encryptHomeStorage
159
+     * @return DataResponse
160
+     */
161
+    public function setEncryptHomeStorage($encryptHomeStorage) {
162
+        $this->util->setEncryptHomeStorage($encryptHomeStorage);
163
+        return new DataResponse();
164
+    }
165 165
 }
Please login to merge, or discard this patch.
apps/comments/lib/Activity/Setting.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -27,72 +27,72 @@
 block discarded – undo
27 27
 
28 28
 class Setting implements ISetting {
29 29
 
30
-	/** @var IL10N */
31
-	protected $l;
30
+    /** @var IL10N */
31
+    protected $l;
32 32
 
33
-	/**
34
-	 * @param IL10N $l
35
-	 */
36
-	public function __construct(IL10N $l) {
37
-		$this->l = $l;
38
-	}
33
+    /**
34
+     * @param IL10N $l
35
+     */
36
+    public function __construct(IL10N $l) {
37
+        $this->l = $l;
38
+    }
39 39
 
40
-	/**
41
-	 * @return string Lowercase a-z and underscore only identifier
42
-	 * @since 11.0.0
43
-	 */
44
-	public function getIdentifier() {
45
-		return 'comments';
46
-	}
40
+    /**
41
+     * @return string Lowercase a-z and underscore only identifier
42
+     * @since 11.0.0
43
+     */
44
+    public function getIdentifier() {
45
+        return 'comments';
46
+    }
47 47
 
48
-	/**
49
-	 * @return string A translated string
50
-	 * @since 11.0.0
51
-	 */
52
-	public function getName() {
53
-		return $this->l->t('<strong>Comments</strong> for files');
54
-	}
48
+    /**
49
+     * @return string A translated string
50
+     * @since 11.0.0
51
+     */
52
+    public function getName() {
53
+        return $this->l->t('<strong>Comments</strong> for files');
54
+    }
55 55
 
56
-	/**
57
-	 * @return int whether the filter should be rather on the top or bottom of
58
-	 * the admin section. The filters are arranged in ascending order of the
59
-	 * priority values. It is required to return a value between 0 and 100.
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 50;
64
-	}
56
+    /**
57
+     * @return int whether the filter should be rather on the top or bottom of
58
+     * the admin section. The filters are arranged in ascending order of the
59
+     * priority values. It is required to return a value between 0 and 100.
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 50;
64
+    }
65 65
 
66
-	/**
67
-	 * @return bool True when the option can be changed for the stream
68
-	 * @since 11.0.0
69
-	 */
70
-	public function canChangeStream() {
71
-		return true;
72
-	}
66
+    /**
67
+     * @return bool True when the option can be changed for the stream
68
+     * @since 11.0.0
69
+     */
70
+    public function canChangeStream() {
71
+        return true;
72
+    }
73 73
 
74
-	/**
75
-	 * @return bool True when the option can be changed for the stream
76
-	 * @since 11.0.0
77
-	 */
78
-	public function isDefaultEnabledStream() {
79
-		return true;
80
-	}
74
+    /**
75
+     * @return bool True when the option can be changed for the stream
76
+     * @since 11.0.0
77
+     */
78
+    public function isDefaultEnabledStream() {
79
+        return true;
80
+    }
81 81
 
82
-	/**
83
-	 * @return bool True when the option can be changed for the mail
84
-	 * @since 11.0.0
85
-	 */
86
-	public function canChangeMail() {
87
-		return true;
88
-	}
82
+    /**
83
+     * @return bool True when the option can be changed for the mail
84
+     * @since 11.0.0
85
+     */
86
+    public function canChangeMail() {
87
+        return true;
88
+    }
89 89
 
90
-	/**
91
-	 * @return bool True when the option can be changed for the stream
92
-	 * @since 11.0.0
93
-	 */
94
-	public function isDefaultEnabledMail() {
95
-		return false;
96
-	}
90
+    /**
91
+     * @return bool True when the option can be changed for the stream
92
+     * @since 11.0.0
93
+     */
94
+    public function isDefaultEnabledMail() {
95
+        return false;
96
+    }
97 97
 }
98 98
 
Please login to merge, or discard this patch.
apps/comments/lib/Activity/Filter.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -28,63 +28,63 @@
 block discarded – undo
28 28
 
29 29
 class Filter implements IFilter {
30 30
 
31
-	/** @var IL10N */
32
-	protected $l;
31
+    /** @var IL10N */
32
+    protected $l;
33 33
 
34
-	/** @var IURLGenerator */
35
-	protected $url;
34
+    /** @var IURLGenerator */
35
+    protected $url;
36 36
 
37
-	public function __construct(IL10N $l, IURLGenerator $url) {
38
-		$this->l = $l;
39
-		$this->url = $url;
40
-	}
37
+    public function __construct(IL10N $l, IURLGenerator $url) {
38
+        $this->l = $l;
39
+        $this->url = $url;
40
+    }
41 41
 
42
-	/**
43
-	 * @return string Lowercase a-z only identifier
44
-	 * @since 11.0.0
45
-	 */
46
-	public function getIdentifier() {
47
-		return 'comments';
48
-	}
42
+    /**
43
+     * @return string Lowercase a-z only identifier
44
+     * @since 11.0.0
45
+     */
46
+    public function getIdentifier() {
47
+        return 'comments';
48
+    }
49 49
 
50
-	/**
51
-	 * @return string A translated string
52
-	 * @since 11.0.0
53
-	 */
54
-	public function getName() {
55
-		return $this->l->t('Comments');
56
-	}
50
+    /**
51
+     * @return string A translated string
52
+     * @since 11.0.0
53
+     */
54
+    public function getName() {
55
+        return $this->l->t('Comments');
56
+    }
57 57
 
58
-	/**
59
-	 * @return int
60
-	 * @since 11.0.0
61
-	 */
62
-	public function getPriority() {
63
-		return 40;
64
-	}
58
+    /**
59
+     * @return int
60
+     * @since 11.0.0
61
+     */
62
+    public function getPriority() {
63
+        return 40;
64
+    }
65 65
 
66
-	/**
67
-	 * @return string Full URL to an icon, empty string when none is given
68
-	 * @since 11.0.0
69
-	 */
70
-	public function getIcon() {
71
-		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'));
72
-	}
66
+    /**
67
+     * @return string Full URL to an icon, empty string when none is given
68
+     * @since 11.0.0
69
+     */
70
+    public function getIcon() {
71
+        return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg'));
72
+    }
73 73
 
74
-	/**
75
-	 * @param string[] $types
76
-	 * @return string[] An array of allowed apps from which activities should be displayed
77
-	 * @since 11.0.0
78
-	 */
79
-	public function filterTypes(array $types) {
80
-		return $types;
81
-	}
74
+    /**
75
+     * @param string[] $types
76
+     * @return string[] An array of allowed apps from which activities should be displayed
77
+     * @since 11.0.0
78
+     */
79
+    public function filterTypes(array $types) {
80
+        return $types;
81
+    }
82 82
 
83
-	/**
84
-	 * @return string[] An array of allowed apps from which activities should be displayed
85
-	 * @since 11.0.0
86
-	 */
87
-	public function allowedApps() {
88
-		return ['comments'];
89
-	}
83
+    /**
84
+     * @return string[] An array of allowed apps from which activities should be displayed
85
+     * @since 11.0.0
86
+     */
87
+    public function allowedApps() {
88
+        return ['comments'];
89
+    }
90 90
 }
Please login to merge, or discard this patch.