Completed
Push — master ( eba447...1a7516 )
by Blizzz
18:31
created
lib/private/Lockdown/LockdownManager.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,56 +24,56 @@
 block discarded – undo
24 24
 use OCP\Lockdown\ILockdownManager;
25 25
 
26 26
 class LockdownManager implements ILockdownManager {
27
-	/** @var ISession */
28
-	private $sessionCallback;
27
+    /** @var ISession */
28
+    private $sessionCallback;
29 29
 
30
-	private $enabled = false;
30
+    private $enabled = false;
31 31
 
32
-	/** @var array|null */
33
-	private $scope;
32
+    /** @var array|null */
33
+    private $scope;
34 34
 
35
-	/**
36
-	 * LockdownManager constructor.
37
-	 *
38
-	 * @param callable $sessionCallback we need to inject the session lazily to avoid dependency loops
39
-	 */
40
-	public function __construct(callable $sessionCallback) {
41
-		$this->sessionCallback = $sessionCallback;
42
-	}
35
+    /**
36
+     * LockdownManager constructor.
37
+     *
38
+     * @param callable $sessionCallback we need to inject the session lazily to avoid dependency loops
39
+     */
40
+    public function __construct(callable $sessionCallback) {
41
+        $this->sessionCallback = $sessionCallback;
42
+    }
43 43
 
44 44
 
45
-	public function enable() {
46
-		$this->enabled = true;
47
-	}
45
+    public function enable() {
46
+        $this->enabled = true;
47
+    }
48 48
 
49
-	/**
50
-	 * @return ISession
51
-	 */
52
-	private function getSession() {
53
-		$callback = $this->sessionCallback;
54
-		return $callback();
55
-	}
49
+    /**
50
+     * @return ISession
51
+     */
52
+    private function getSession() {
53
+        $callback = $this->sessionCallback;
54
+        return $callback();
55
+    }
56 56
 
57
-	private function getScopeAsArray() {
58
-		if (!$this->scope) {
59
-			$session = $this->getSession();
60
-			$sessionScope = $session->get('token_scope');
61
-			if ($sessionScope) {
62
-				$this->scope = $sessionScope;
63
-			}
64
-		}
65
-		return $this->scope;
66
-	}
57
+    private function getScopeAsArray() {
58
+        if (!$this->scope) {
59
+            $session = $this->getSession();
60
+            $sessionScope = $session->get('token_scope');
61
+            if ($sessionScope) {
62
+                $this->scope = $sessionScope;
63
+            }
64
+        }
65
+        return $this->scope;
66
+    }
67 67
 
68
-	public function setToken(IToken $token) {
69
-		$this->scope = $token->getScopeAsArray();
70
-		$session = $this->getSession();
71
-		$session->set('token_scope', $this->scope);
72
-		$this->enable();
73
-	}
68
+    public function setToken(IToken $token) {
69
+        $this->scope = $token->getScopeAsArray();
70
+        $session = $this->getSession();
71
+        $session->set('token_scope', $this->scope);
72
+        $this->enable();
73
+    }
74 74
 
75
-	public function canAccessFilesystem() {
76
-		$scope = $this->getScopeAsArray();
77
-		return !$scope || $scope['filesystem'];
78
-	}
75
+    public function canAccessFilesystem() {
76
+        $scope = $this->getScopeAsArray();
77
+        return !$scope || $scope['filesystem'];
78
+    }
79 79
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Controller/RenewPasswordController.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return TemplateResponse|RedirectResponse
86 86
 	 */
87 87
 	public function showRenewPasswordForm($user) {
88
-		if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
88
+		if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
89 89
 			return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
90 90
 		}
91 91
 		$parameters = [];
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return RedirectResponse
130 130
 	 */
131 131
 	public function tryRenewPassword($user, $oldPassword, $newPassword) {
132
-		if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
132
+		if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
133 133
 			return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
134 134
 		}
135 135
 		$args = !is_null($user) ? ['user' => $user] : [];
Please login to merge, or discard this patch.
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -37,144 +37,144 @@
 block discarded – undo
37 37
 use OCP\IUserManager;
38 38
 
39 39
 class RenewPasswordController extends Controller {
40
-	/** @var IUserManager */
41
-	private $userManager;
42
-	/** @var IConfig */
43
-	private $config;
44
-	/** @var IL10N */
45
-	protected $l10n;
46
-	/** @var ISession */
47
-	private $session;
48
-	/** @var IURLGenerator */
49
-	private $urlGenerator;
40
+    /** @var IUserManager */
41
+    private $userManager;
42
+    /** @var IConfig */
43
+    private $config;
44
+    /** @var IL10N */
45
+    protected $l10n;
46
+    /** @var ISession */
47
+    private $session;
48
+    /** @var IURLGenerator */
49
+    private $urlGenerator;
50 50
 
51
-	/**
52
-	 * @param string $appName
53
-	 * @param IRequest $request
54
-	 * @param IUserManager $userManager
55
-	 * @param IConfig $config
56
-	 * @param IURLGenerator $urlGenerator
57
-	 */
58
-	function __construct($appName, IRequest $request, IUserManager $userManager, 
59
-		IConfig $config, IL10N $l10n, ISession $session, IURLGenerator $urlGenerator) {
60
-		parent::__construct($appName, $request);
61
-		$this->userManager = $userManager;
62
-		$this->config = $config;
63
-		$this->l10n = $l10n;
64
-		$this->session = $session;
65
-		$this->urlGenerator = $urlGenerator;
66
-	}
51
+    /**
52
+     * @param string $appName
53
+     * @param IRequest $request
54
+     * @param IUserManager $userManager
55
+     * @param IConfig $config
56
+     * @param IURLGenerator $urlGenerator
57
+     */
58
+    function __construct($appName, IRequest $request, IUserManager $userManager, 
59
+        IConfig $config, IL10N $l10n, ISession $session, IURLGenerator $urlGenerator) {
60
+        parent::__construct($appName, $request);
61
+        $this->userManager = $userManager;
62
+        $this->config = $config;
63
+        $this->l10n = $l10n;
64
+        $this->session = $session;
65
+        $this->urlGenerator = $urlGenerator;
66
+    }
67 67
 
68
-	/**
69
-	 * @PublicPage
70
-	 * @NoCSRFRequired
71
-	 *
72
-	 * @return RedirectResponse
73
-	 */
74
-	public function cancel() {
75
-		return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
76
-	}
68
+    /**
69
+     * @PublicPage
70
+     * @NoCSRFRequired
71
+     *
72
+     * @return RedirectResponse
73
+     */
74
+    public function cancel() {
75
+        return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
76
+    }
77 77
 
78
-	/**
79
-	 * @PublicPage
80
-	 * @NoCSRFRequired
81
-	 * @UseSession
82
-	 *
83
-	 * @param string $user
84
-	 *
85
-	 * @return TemplateResponse|RedirectResponse
86
-	 */
87
-	public function showRenewPasswordForm($user) {
88
-		if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
89
-			return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
90
-		}
91
-		$parameters = [];
92
-		$renewPasswordMessages = $this->session->get('renewPasswordMessages');
93
-		$errors = [];
94
-		$messages = [];
95
-		if (is_array($renewPasswordMessages)) {
96
-			list($errors, $messages) = $renewPasswordMessages;
97
-		}
98
-		$this->session->remove('renewPasswordMessages');
99
-		foreach ($errors as $value) {
100
-			$parameters[$value] = true;
101
-		}
78
+    /**
79
+     * @PublicPage
80
+     * @NoCSRFRequired
81
+     * @UseSession
82
+     *
83
+     * @param string $user
84
+     *
85
+     * @return TemplateResponse|RedirectResponse
86
+     */
87
+    public function showRenewPasswordForm($user) {
88
+        if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
89
+            return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
90
+        }
91
+        $parameters = [];
92
+        $renewPasswordMessages = $this->session->get('renewPasswordMessages');
93
+        $errors = [];
94
+        $messages = [];
95
+        if (is_array($renewPasswordMessages)) {
96
+            list($errors, $messages) = $renewPasswordMessages;
97
+        }
98
+        $this->session->remove('renewPasswordMessages');
99
+        foreach ($errors as $value) {
100
+            $parameters[$value] = true;
101
+        }
102 102
 
103
-		$parameters['messages'] = $messages;
104
-		$parameters['user'] = $user;
103
+        $parameters['messages'] = $messages;
104
+        $parameters['user'] = $user;
105 105
 
106
-		$parameters['canResetPassword'] = true;
107
-		$parameters['resetPasswordLink'] = $this->config->getSystemValue('lost_password_link', '');
108
-		if (!$parameters['resetPasswordLink']) {
109
-			$userObj = $this->userManager->get($user);
110
-			if ($userObj instanceof IUser) {
111
-				$parameters['canResetPassword'] = $userObj->canChangePassword();
112
-			}
113
-		}
114
-		$parameters['cancelLink'] = $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm');
106
+        $parameters['canResetPassword'] = true;
107
+        $parameters['resetPasswordLink'] = $this->config->getSystemValue('lost_password_link', '');
108
+        if (!$parameters['resetPasswordLink']) {
109
+            $userObj = $this->userManager->get($user);
110
+            if ($userObj instanceof IUser) {
111
+                $parameters['canResetPassword'] = $userObj->canChangePassword();
112
+            }
113
+        }
114
+        $parameters['cancelLink'] = $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm');
115 115
 
116
-		return new TemplateResponse(
117
-			$this->appName, 'renewpassword', $parameters, 'guest'
118
-		);
119
-	}
116
+        return new TemplateResponse(
117
+            $this->appName, 'renewpassword', $parameters, 'guest'
118
+        );
119
+    }
120 120
 
121
-	/**
122
-	 * @PublicPage
123
-	 * @UseSession
124
-	 *
125
-	 * @param string $user
126
-	 * @param string $oldPassword
127
-	 * @param string $newPassword
128
-	 *
129
-	 * @return RedirectResponse
130
-	 */
131
-	public function tryRenewPassword($user, $oldPassword, $newPassword) {
132
-		if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
133
-			return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
134
-		}
135
-		$args = !is_null($user) ? ['user' => $user] : [];
136
-		$loginResult = $this->userManager->checkPassword($user, $oldPassword);
137
-		if ($loginResult === false) {
138
-			$this->session->set('renewPasswordMessages', [
139
-				['invalidpassword'], []
140
-			]);
141
-			return new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
142
-		}
121
+    /**
122
+     * @PublicPage
123
+     * @UseSession
124
+     *
125
+     * @param string $user
126
+     * @param string $oldPassword
127
+     * @param string $newPassword
128
+     *
129
+     * @return RedirectResponse
130
+     */
131
+    public function tryRenewPassword($user, $oldPassword, $newPassword) {
132
+        if($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
133
+            return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
134
+        }
135
+        $args = !is_null($user) ? ['user' => $user] : [];
136
+        $loginResult = $this->userManager->checkPassword($user, $oldPassword);
137
+        if ($loginResult === false) {
138
+            $this->session->set('renewPasswordMessages', [
139
+                ['invalidpassword'], []
140
+            ]);
141
+            return new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
142
+        }
143 143
 		
144
-		try {
145
-			if (!is_null($newPassword) && \OC_User::setPassword($user, $newPassword)) {
146
-				$this->session->set('loginMessages', [
147
-					[], [$this->l10n->t("Please login with the new password")]
148
-				]);
149
-				$this->config->setUserValue($user, 'user_ldap', 'needsPasswordReset', 'false');
150
-				return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));
151
-			} else {
152
-				$this->session->set('renewPasswordMessages', [
153
-					['internalexception'], []
154
-				]);
155
-			}
156
-		} catch (HintException $e) {
157
-			$this->session->set('renewPasswordMessages', [
158
-				[], [$e->getHint()]
159
-			]);
160
-		}
144
+        try {
145
+            if (!is_null($newPassword) && \OC_User::setPassword($user, $newPassword)) {
146
+                $this->session->set('loginMessages', [
147
+                    [], [$this->l10n->t("Please login with the new password")]
148
+                ]);
149
+                $this->config->setUserValue($user, 'user_ldap', 'needsPasswordReset', 'false');
150
+                return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));
151
+            } else {
152
+                $this->session->set('renewPasswordMessages', [
153
+                    ['internalexception'], []
154
+                ]);
155
+            }
156
+        } catch (HintException $e) {
157
+            $this->session->set('renewPasswordMessages', [
158
+                [], [$e->getHint()]
159
+            ]);
160
+        }
161 161
 
162
-		return new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
163
-	}
162
+        return new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
163
+    }
164 164
 
165
-	/**
166
-	 * @PublicPage
167
-	 * @NoCSRFRequired
168
-	 * @UseSession
169
-	 *
170
-	 * @return RedirectResponse
171
-	 */
172
-	public function showLoginFormInvalidPassword($user) {
173
-		$args = !is_null($user) ? ['user' => $user] : [];
174
-		$this->session->set('loginMessages', [
175
-			['invalidpassword'], []
176
-		]);
177
-		return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));
178
-	}
165
+    /**
166
+     * @PublicPage
167
+     * @NoCSRFRequired
168
+     * @UseSession
169
+     *
170
+     * @return RedirectResponse
171
+     */
172
+    public function showLoginFormInvalidPassword($user) {
173
+        $args = !is_null($user) ? ['user' => $user] : [];
174
+        $this->session->set('loginMessages', [
175
+            ['invalidpassword'], []
176
+        ]);
177
+        return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));
178
+    }
179 179
 
180 180
 }
Please login to merge, or discard this patch.
settings/Mailer/NewUserMailHelper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -102,13 +102,13 @@
 block discarded – undo
102 102
 		if ($generatePasswordResetToken) {
103 103
 			$token = $this->secureRandom->generate(
104 104
 				21,
105
-				ISecureRandom::CHAR_DIGITS .
106
-				ISecureRandom::CHAR_LOWER .
105
+				ISecureRandom::CHAR_DIGITS.
106
+				ISecureRandom::CHAR_LOWER.
107 107
 				ISecureRandom::CHAR_UPPER
108 108
 			);
109
-			$tokenValue = $this->timeFactory->getTime() . ':' . $token;
109
+			$tokenValue = $this->timeFactory->getTime().':'.$token;
110 110
 			$mailAddress = (null !== $user->getEMailAddress()) ? $user->getEMailAddress() : '';
111
-			$encryptedValue = $this->crypto->encrypt($tokenValue, $mailAddress . $this->config->getSystemValue('secret'));
111
+			$encryptedValue = $this->crypto->encrypt($tokenValue, $mailAddress.$this->config->getSystemValue('secret'));
112 112
 			$this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue);
113 113
 			$link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]);
114 114
 		} else {
Please login to merge, or discard this patch.
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -38,135 +38,135 @@
 block discarded – undo
38 38
 use OCP\Security\ISecureRandom;
39 39
 
40 40
 class NewUserMailHelper {
41
-	/** @var Defaults */
42
-	private $themingDefaults;
43
-	/** @var IURLGenerator */
44
-	private $urlGenerator;
45
-	/** @var IL10N */
46
-	private $l10n;
47
-	/** @var IMailer */
48
-	private $mailer;
49
-	/** @var ISecureRandom */
50
-	private $secureRandom;
51
-	/** @var ITimeFactory */
52
-	private $timeFactory;
53
-	/** @var IConfig */
54
-	private $config;
55
-	/** @var ICrypto */
56
-	private $crypto;
57
-	/** @var string */
58
-	private $fromAddress;
41
+    /** @var Defaults */
42
+    private $themingDefaults;
43
+    /** @var IURLGenerator */
44
+    private $urlGenerator;
45
+    /** @var IL10N */
46
+    private $l10n;
47
+    /** @var IMailer */
48
+    private $mailer;
49
+    /** @var ISecureRandom */
50
+    private $secureRandom;
51
+    /** @var ITimeFactory */
52
+    private $timeFactory;
53
+    /** @var IConfig */
54
+    private $config;
55
+    /** @var ICrypto */
56
+    private $crypto;
57
+    /** @var string */
58
+    private $fromAddress;
59 59
 
60
-	/**
61
-	 * @param Defaults $themingDefaults
62
-	 * @param IURLGenerator $urlGenerator
63
-	 * @param IL10N $l10n
64
-	 * @param IMailer $mailer
65
-	 * @param ISecureRandom $secureRandom
66
-	 * @param ITimeFactory $timeFactory
67
-	 * @param IConfig $config
68
-	 * @param ICrypto $crypto
69
-	 * @param string $fromAddress
70
-	 */
71
-	public function __construct(Defaults $themingDefaults,
72
-								IURLGenerator $urlGenerator,
73
-								IL10N $l10n,
74
-								IMailer $mailer,
75
-								ISecureRandom $secureRandom,
76
-								ITimeFactory $timeFactory,
77
-								IConfig $config,
78
-								ICrypto $crypto,
79
-								$fromAddress) {
80
-		$this->themingDefaults = $themingDefaults;
81
-		$this->urlGenerator = $urlGenerator;
82
-		$this->l10n = $l10n;
83
-		$this->mailer = $mailer;
84
-		$this->secureRandom = $secureRandom;
85
-		$this->timeFactory = $timeFactory;
86
-		$this->config = $config;
87
-		$this->crypto = $crypto;
88
-		$this->fromAddress = $fromAddress;
89
-	}
60
+    /**
61
+     * @param Defaults $themingDefaults
62
+     * @param IURLGenerator $urlGenerator
63
+     * @param IL10N $l10n
64
+     * @param IMailer $mailer
65
+     * @param ISecureRandom $secureRandom
66
+     * @param ITimeFactory $timeFactory
67
+     * @param IConfig $config
68
+     * @param ICrypto $crypto
69
+     * @param string $fromAddress
70
+     */
71
+    public function __construct(Defaults $themingDefaults,
72
+                                IURLGenerator $urlGenerator,
73
+                                IL10N $l10n,
74
+                                IMailer $mailer,
75
+                                ISecureRandom $secureRandom,
76
+                                ITimeFactory $timeFactory,
77
+                                IConfig $config,
78
+                                ICrypto $crypto,
79
+                                $fromAddress) {
80
+        $this->themingDefaults = $themingDefaults;
81
+        $this->urlGenerator = $urlGenerator;
82
+        $this->l10n = $l10n;
83
+        $this->mailer = $mailer;
84
+        $this->secureRandom = $secureRandom;
85
+        $this->timeFactory = $timeFactory;
86
+        $this->config = $config;
87
+        $this->crypto = $crypto;
88
+        $this->fromAddress = $fromAddress;
89
+    }
90 90
 
91
-	/**
92
-	 * Set the IL10N object
93
-	 *
94
-	 * @param IL10N $l10n
95
-	 */
96
-	public function setL10N(IL10N $l10n) {
97
-		$this->l10n = $l10n;
98
-	}
91
+    /**
92
+     * Set the IL10N object
93
+     *
94
+     * @param IL10N $l10n
95
+     */
96
+    public function setL10N(IL10N $l10n) {
97
+        $this->l10n = $l10n;
98
+    }
99 99
 
100
-	/**
101
-	 * @param IUser $user
102
-	 * @param bool $generatePasswordResetToken
103
-	 * @return IEMailTemplate
104
-	 */
105
-	public function generateTemplate(IUser $user, $generatePasswordResetToken = false) {
106
-		if ($generatePasswordResetToken) {
107
-			$token = $this->secureRandom->generate(
108
-				21,
109
-				ISecureRandom::CHAR_DIGITS .
110
-				ISecureRandom::CHAR_LOWER .
111
-				ISecureRandom::CHAR_UPPER
112
-			);
113
-			$tokenValue = $this->timeFactory->getTime() . ':' . $token;
114
-			$mailAddress = (null !== $user->getEMailAddress()) ? $user->getEMailAddress() : '';
115
-			$encryptedValue = $this->crypto->encrypt($tokenValue, $mailAddress . $this->config->getSystemValue('secret'));
116
-			$this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue);
117
-			$link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]);
118
-		} else {
119
-			$link = $this->urlGenerator->getAbsoluteURL('/');
120
-		}
121
-		$displayName = $user->getDisplayName();
122
-		$userId = $user->getUID();
100
+    /**
101
+     * @param IUser $user
102
+     * @param bool $generatePasswordResetToken
103
+     * @return IEMailTemplate
104
+     */
105
+    public function generateTemplate(IUser $user, $generatePasswordResetToken = false) {
106
+        if ($generatePasswordResetToken) {
107
+            $token = $this->secureRandom->generate(
108
+                21,
109
+                ISecureRandom::CHAR_DIGITS .
110
+                ISecureRandom::CHAR_LOWER .
111
+                ISecureRandom::CHAR_UPPER
112
+            );
113
+            $tokenValue = $this->timeFactory->getTime() . ':' . $token;
114
+            $mailAddress = (null !== $user->getEMailAddress()) ? $user->getEMailAddress() : '';
115
+            $encryptedValue = $this->crypto->encrypt($tokenValue, $mailAddress . $this->config->getSystemValue('secret'));
116
+            $this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue);
117
+            $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]);
118
+        } else {
119
+            $link = $this->urlGenerator->getAbsoluteURL('/');
120
+        }
121
+        $displayName = $user->getDisplayName();
122
+        $userId = $user->getUID();
123 123
 
124
-		$emailTemplate = $this->mailer->createEMailTemplate('settings.Welcome', [
125
-			'link' => $link,
126
-			'displayname' => $displayName,
127
-			'userid' => $userId,
128
-			'instancename' => $this->themingDefaults->getName(),
129
-			'resetTokenGenerated' => $generatePasswordResetToken,
130
-		]);
124
+        $emailTemplate = $this->mailer->createEMailTemplate('settings.Welcome', [
125
+            'link' => $link,
126
+            'displayname' => $displayName,
127
+            'userid' => $userId,
128
+            'instancename' => $this->themingDefaults->getName(),
129
+            'resetTokenGenerated' => $generatePasswordResetToken,
130
+        ]);
131 131
 
132
-		$emailTemplate->setSubject($this->l10n->t('Your %s account was created', [$this->themingDefaults->getName()]));
133
-		$emailTemplate->addHeader();
134
-		if ($displayName === $userId) {
135
-			$emailTemplate->addHeading($this->l10n->t('Welcome aboard'));
136
-		} else {
137
-			$emailTemplate->addHeading($this->l10n->t('Welcome aboard %s', [$displayName]));
138
-		}
139
-		$emailTemplate->addBodyText($this->l10n->t('Welcome to your %s account, you can add, protect, and share your data.', [$this->themingDefaults->getName()]));
140
-		$emailTemplate->addBodyText($this->l10n->t('Your username is: %s', [$userId]));
141
-		if ($generatePasswordResetToken) {
142
-			$leftButtonText = $this->l10n->t('Set your password');
143
-		} else {
144
-			$leftButtonText = $this->l10n->t('Go to %s', [$this->themingDefaults->getName()]);
145
-		}
146
-		$emailTemplate->addBodyButtonGroup(
147
-			$leftButtonText,
148
-			$link,
149
-			$this->l10n->t('Install Client'),
150
-			'https://nextcloud.com/install/#install-clients'
151
-		);
152
-		$emailTemplate->addFooter();
132
+        $emailTemplate->setSubject($this->l10n->t('Your %s account was created', [$this->themingDefaults->getName()]));
133
+        $emailTemplate->addHeader();
134
+        if ($displayName === $userId) {
135
+            $emailTemplate->addHeading($this->l10n->t('Welcome aboard'));
136
+        } else {
137
+            $emailTemplate->addHeading($this->l10n->t('Welcome aboard %s', [$displayName]));
138
+        }
139
+        $emailTemplate->addBodyText($this->l10n->t('Welcome to your %s account, you can add, protect, and share your data.', [$this->themingDefaults->getName()]));
140
+        $emailTemplate->addBodyText($this->l10n->t('Your username is: %s', [$userId]));
141
+        if ($generatePasswordResetToken) {
142
+            $leftButtonText = $this->l10n->t('Set your password');
143
+        } else {
144
+            $leftButtonText = $this->l10n->t('Go to %s', [$this->themingDefaults->getName()]);
145
+        }
146
+        $emailTemplate->addBodyButtonGroup(
147
+            $leftButtonText,
148
+            $link,
149
+            $this->l10n->t('Install Client'),
150
+            'https://nextcloud.com/install/#install-clients'
151
+        );
152
+        $emailTemplate->addFooter();
153 153
 
154
-		return $emailTemplate;
155
-	}
154
+        return $emailTemplate;
155
+    }
156 156
 
157
-	/**
158
-	 * Sends a welcome mail to $user
159
-	 *
160
-	 * @param IUser $user
161
-	 * @param IEmailTemplate $emailTemplate
162
-	 * @throws \Exception If mail could not be sent
163
-	 */
164
-	public function sendMail(IUser $user,
165
-							 IEMailTemplate $emailTemplate) {
166
-		$message = $this->mailer->createMessage();
167
-		$message->setTo([$user->getEMailAddress() => $user->getDisplayName()]);
168
-		$message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]);
169
-		$message->useTemplate($emailTemplate);
170
-		$this->mailer->send($message);
171
-	}
157
+    /**
158
+     * Sends a welcome mail to $user
159
+     *
160
+     * @param IUser $user
161
+     * @param IEmailTemplate $emailTemplate
162
+     * @throws \Exception If mail could not be sent
163
+     */
164
+    public function sendMail(IUser $user,
165
+                                IEMailTemplate $emailTemplate) {
166
+        $message = $this->mailer->createMessage();
167
+        $message->setTo([$user->getEMailAddress() => $user->getDisplayName()]);
168
+        $message->setFrom([$this->fromAddress => $this->themingDefaults->getName()]);
169
+        $message->useTemplate($emailTemplate);
170
+        $this->mailer->send($message);
171
+    }
172 172
 }
Please login to merge, or discard this patch.
apps/provisioning_api/lib/AppInfo/Application.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -11,35 +11,35 @@
 block discarded – undo
11 11
 use OCP\Util;
12 12
 
13 13
 class Application extends App {
14
-	public function __construct(array $urlParams = array()) {
15
-		parent::__construct('provisioning_api', $urlParams);
14
+    public function __construct(array $urlParams = array()) {
15
+        parent::__construct('provisioning_api', $urlParams);
16 16
 
17
-		$container = $this->getContainer();
18
-		$server = $container->getServer();
17
+        $container = $this->getContainer();
18
+        $server = $container->getServer();
19 19
 
20
-		$container->registerService(NewUserMailHelper::class, function(SimpleContainer $c) use ($server) {
21
-			return new NewUserMailHelper(
22
-				$server->query(Defaults::class),
23
-				$server->getURLGenerator(),
24
-				$server->getL10N('settings'),
25
-				$server->getMailer(),
26
-				$server->getSecureRandom(),
27
-				new TimeFactory(),
28
-				$server->getConfig(),
29
-				$server->getCrypto(),
30
-				Util::getDefaultEmailAddress('no-reply')
31
-			);
32
-		});
33
-		$container->registerService('ProvisioningApiMiddleware', function(SimpleContainer $c) use ($server) {
34
-			$user = $server->getUserManager()->get($c['UserId']);
35
-			$isAdmin = $user !== null ? $server->getGroupManager()->isAdmin($user->getUID()) : false;
36
-			$isSubAdmin = $user !== null ? $server->getGroupManager()->getSubAdmin()->isSubAdmin($user) : false;
37
-			return new ProvisioningApiMiddleware(
38
-				$c['ControllerMethodReflector'],
39
-				$isAdmin,
40
-				$isSubAdmin
41
-			);
42
-		});
43
-		$container->registerMiddleWare('ProvisioningApiMiddleware');
44
-	}
20
+        $container->registerService(NewUserMailHelper::class, function(SimpleContainer $c) use ($server) {
21
+            return new NewUserMailHelper(
22
+                $server->query(Defaults::class),
23
+                $server->getURLGenerator(),
24
+                $server->getL10N('settings'),
25
+                $server->getMailer(),
26
+                $server->getSecureRandom(),
27
+                new TimeFactory(),
28
+                $server->getConfig(),
29
+                $server->getCrypto(),
30
+                Util::getDefaultEmailAddress('no-reply')
31
+            );
32
+        });
33
+        $container->registerService('ProvisioningApiMiddleware', function(SimpleContainer $c) use ($server) {
34
+            $user = $server->getUserManager()->get($c['UserId']);
35
+            $isAdmin = $user !== null ? $server->getGroupManager()->isAdmin($user->getUID()) : false;
36
+            $isSubAdmin = $user !== null ? $server->getGroupManager()->getSubAdmin()->isSubAdmin($user) : false;
37
+            return new ProvisioningApiMiddleware(
38
+                $c['ControllerMethodReflector'],
39
+                $isAdmin,
40
+                $isSubAdmin
41
+            );
42
+        });
43
+        $container->registerMiddleWare('ProvisioningApiMiddleware');
44
+    }
45 45
 }
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/PublicCalendarObject.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@
 block discarded – undo
23 23
 
24 24
 class PublicCalendarObject extends CalendarObject {
25 25
 
26
-	/**
27
-	 * public calendars are always shared
28
-	 * @return bool
29
-	 */
30
-	protected function isShared() {
31
-		return true;
32
-	}
26
+    /**
27
+     * public calendars are always shared
28
+     * @return bool
29
+     */
30
+    protected function isShared() {
31
+        return true;
32
+    }
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
apps/dav/lib/CalDAV/PublicCalendar.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -25,63 +25,63 @@
 block discarded – undo
25 25
 
26 26
 class PublicCalendar extends Calendar {
27 27
 
28
-	/**
29
-	 * @param string $name
30
-	 * @throws NotFound
31
-	 * @return PublicCalendarObject
32
-	 */
33
-	public function getChild($name) {
34
-		$obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
28
+    /**
29
+     * @param string $name
30
+     * @throws NotFound
31
+     * @return PublicCalendarObject
32
+     */
33
+    public function getChild($name) {
34
+        $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
35 35
 
36
-		if (!$obj) {
37
-			throw new NotFound('Calendar object not found');
38
-		}
39
-		if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
40
-			throw new NotFound('Calendar object not found');
41
-		}
42
-		$obj['acl'] = $this->getChildACL();
36
+        if (!$obj) {
37
+            throw new NotFound('Calendar object not found');
38
+        }
39
+        if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
40
+            throw new NotFound('Calendar object not found');
41
+        }
42
+        $obj['acl'] = $this->getChildACL();
43 43
 
44
-		return new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
45
-	}
44
+        return new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
45
+    }
46 46
 
47
-	/**
48
-	 * @return PublicCalendarObject[]
49
-	 */
50
-	public function getChildren() {
51
-		$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
52
-		$children = [];
53
-		foreach ($objs as $obj) {
54
-			if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
55
-				continue;
56
-			}
57
-			$obj['acl'] = $this->getChildACL();
58
-			$children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
59
-		}
60
-		return $children;
61
-	}
47
+    /**
48
+     * @return PublicCalendarObject[]
49
+     */
50
+    public function getChildren() {
51
+        $objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
52
+        $children = [];
53
+        foreach ($objs as $obj) {
54
+            if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
55
+                continue;
56
+            }
57
+            $obj['acl'] = $this->getChildACL();
58
+            $children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
59
+        }
60
+        return $children;
61
+    }
62 62
 
63
-	/**
64
-	 * @param string[] $paths
65
-	 * @return PublicCalendarObject[]
66
-	 */
67
-	public function getMultipleChildren(array $paths) {
68
-		$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
69
-		$children = [];
70
-		foreach ($objs as $obj) {
71
-			if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
72
-				continue;
73
-			}
74
-			$obj['acl'] = $this->getChildACL();
75
-			$children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
76
-		}
77
-		return $children;
78
-	}
63
+    /**
64
+     * @param string[] $paths
65
+     * @return PublicCalendarObject[]
66
+     */
67
+    public function getMultipleChildren(array $paths) {
68
+        $objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
69
+        $children = [];
70
+        foreach ($objs as $obj) {
71
+            if ($obj['classification'] === CalDavBackend::CLASSIFICATION_PRIVATE) {
72
+                continue;
73
+            }
74
+            $obj['acl'] = $this->getChildACL();
75
+            $children[] = new PublicCalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
76
+        }
77
+        return $children;
78
+    }
79 79
 
80
-	/**
81
-	 * public calendars are always shared
82
-	 * @return bool
83
-	 */
84
-	protected function isShared() {
85
-		return true;
86
-	}
80
+    /**
81
+     * public calendars are always shared
82
+     * @return bool
83
+     */
84
+    protected function isShared() {
85
+        return true;
86
+    }
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
lib/public/Contacts/ContactsMenu/IProvider.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
  */
30 30
 interface IProvider {
31 31
 
32
-	/**
33
-	 * @since 12.0
34
-	 * @param IEntry $entry
35
-	 * @return void
36
-	 */
37
-	public function process(IEntry $entry);
32
+    /**
33
+     * @since 12.0
34
+     * @param IEntry $entry
35
+     * @return void
36
+     */
37
+    public function process(IEntry $entry);
38 38
 }
Please login to merge, or discard this patch.
lib/public/Share/IShareHelper.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
  */
33 33
 interface IShareHelper {
34 34
 
35
-	/**
36
-	 * @param Node $node
37
-	 * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]]
38
-	 * @since 12
39
-	 */
40
-	public function getPathsForAccessList(Node $node);
35
+    /**
36
+     * @param Node $node
37
+     * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]]
38
+     * @since 12
39
+     */
40
+    public function getPathsForAccessList(Node $node);
41 41
 }
Please login to merge, or discard this patch.
apps/sharebymail/lib/Capabilities.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,24 +27,24 @@
 block discarded – undo
27 27
 
28 28
 class Capabilities implements ICapability {
29 29
 
30
-	/**
31
-	 * Function an app uses to return the capabilities
32
-	 *
33
-	 * @return array Array containing the apps capabilities
34
-	 * @since 8.2.0
35
-	 */
36
-	public function getCapabilities() {
37
-		return [
38
-			'files_sharing' =>
39
-				[
40
-					'sharebymail' =>
41
-						[
42
-							'enabled' => true,
43
-							'upload_files_drop' => ['enabled' => true],
44
-							'password' => ['enabled' => true],
45
-							'expire_date' => ['enabled' => true]
46
-						]
47
-				]
48
-		];
49
-	}
30
+    /**
31
+     * Function an app uses to return the capabilities
32
+     *
33
+     * @return array Array containing the apps capabilities
34
+     * @since 8.2.0
35
+     */
36
+    public function getCapabilities() {
37
+        return [
38
+            'files_sharing' =>
39
+                [
40
+                    'sharebymail' =>
41
+                        [
42
+                            'enabled' => true,
43
+                            'upload_files_drop' => ['enabled' => true],
44
+                            'password' => ['enabled' => true],
45
+                            'expire_date' => ['enabled' => true]
46
+                        ]
47
+                ]
48
+        ];
49
+    }
50 50
 }
Please login to merge, or discard this patch.