Skip to content

Commit

Permalink
Minor cleanup in core Controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
rullzer committed Aug 29, 2016
1 parent c0ed865 commit 9c4f1a4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion core/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

namespace OC\Core\Controller;

use OC\AppFramework\Utility\TimeFactory;
use OC\Authentication\TwoFactorAuth\Manager;
use OC\Security\Bruteforce\Throttler;
use OC\User\Session;
Expand Down
5 changes: 2 additions & 3 deletions core/Controller/LostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
use OCP\IUserManager;
use OCP\Mail\IMailer;
use OCP\Security\ISecureRandom;
use OCP\Security\StringUtils;

/**
* Class LostController
Expand Down Expand Up @@ -144,7 +143,7 @@ public function resetform($token, $userId) {
}

/**
* @param string $userId
* @param string $token
* @param string $userId
* @throws \Exception
*/
Expand All @@ -161,7 +160,7 @@ private function checkPasswordResetToken($token, $userId) {
throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired'));
}

if (!StringUtils::equals($splittedToken[1], $token)) {
if (!hash_equals($splittedToken[1], $token)) {
throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
}
}
Expand Down
7 changes: 2 additions & 5 deletions core/Controller/TokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
namespace OC\Core\Controller;

use OC\AppFramework\Http;
use OC\AppFramework\Utility\TimeFactory;
use OC\Authentication\Token\DefaultTokenProvider;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
use OC\User\Manager as UserManager;
use OCA\User_LDAP\User\Manager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;
Expand Down Expand Up @@ -100,9 +97,9 @@ public function generateToken($user, $password, $name = 'unknown client') {

$token = $this->secureRandom->generate(128);
$this->tokenProvider->generateToken($token, $user->getUID(), $loginName, $password, $name, IToken::PERMANENT_TOKEN);
return [
return new JSONResponse([
'token' => $token,
];
]);
}

}
2 changes: 1 addition & 1 deletion core/Controller/TwoFactorChallengeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function selectChallenge($redirect_url) {
*
* @param string $challengeProviderId
* @param string $redirect_url
* @return TemplateResponse
* @return TemplateResponse|RedirectResponse
*/
public function showChallenge($challengeProviderId, $redirect_url) {
$user = $this->userSession->getUser();
Expand Down

0 comments on commit 9c4f1a4

Please sign in to comment.