Code Duplication    Length = 5-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');

lib/private/User/Service/UserSendMail.php 1 location

@@ 130-134 (lines=5) @@
127
		}
128
129
		//The value 43200 = 60*60*12 = 1/2 day
130
		if ($splittedToken[0] < ($this->timeFactory->getTime() - (int)$this->config->getAppValue('core', 'token_expire_time', '43200')) ||
131
			$user->getLastLogin() > $splittedToken[0]) {
132
			$this->config->deleteUserValue($user->getUID(), 'owncloud', 'lostpassword');
133
			throw new UserTokenExpiredException('The token provided had expired.');
134
		}
135
136
		if (!\hash_equals($splittedToken[1], $token)) {
137
			throw new UserTokenMismatchException('The token provided is invalid.');