Code Duplication    Length = 4-5 lines in 2 locations

core/Controller/LostController.php 1 location

@@ 171-175 (lines=5) @@
168
			throw new \Exception($this->l10n->t('Could not reset password because the token is invalid'));
169
		}
170
171
		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*12) ||
172
			$user->getLastLogin() > $splittedToken[0]) {
173
			$this->config->deleteUserValue($userId, 'owncloud', 'lostpassword');
174
			throw new \Exception($this->l10n->t('Could not reset password because the token expired'));
175
		}
176
177
		if (!hash_equals($splittedToken[1], $token)) {
178
			$this->config->deleteUserValue($userId, 'owncloud', 'lostpassword');

settings/Controller/UsersController.php 1 location

@@ 248-251 (lines=4) @@
245
			throw new \Exception($this->l10n->t('Couldn\'t change the email address because the token is invalid'));
246
		}
247
248
		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*12)) {
249
			$this->config->deleteUserValue($userId, 'owncloud', 'changeMail');
250
			throw new \Exception($this->l10n->t('Couldn\'t change the email address because the token is invalid'));
251
		}
252
253
		if (!hash_equals($splittedToken[1], $token)) {
254
			$this->config->deleteUserValue($userId, 'owncloud', 'changeMail');