summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2017-01-03 09:57:52 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2017-01-11 11:01:54 +0100
commit243c9c09419252b379a9ad5e460d77a65e948b58 (patch)
tree2372d23463b72ed0616301d1cea5bb4a98ce0de3 /core/Controller
parentb8d41752ca550763e23b29eca5e0ec4ec7d7ecb6 (diff)
downloadnextcloud-server-243c9c09419252b379a9ad5e460d77a65e948b58.tar.gz
nextcloud-server-243c9c09419252b379a9ad5e460d77a65e948b58.zip
fix coding style and increase code coverage
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/TwoFactorChallengeController.php16
1 files changed, 7 insertions, 9 deletions
diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php
index 13c87b7b0ab..fd4811d3ff6 100644
--- a/core/Controller/TwoFactorChallengeController.php
+++ b/core/Controller/TwoFactorChallengeController.php
@@ -26,10 +26,10 @@ namespace OC\Core\Controller;
use OC\Authentication\TwoFactorAuth\Manager;
use OC_User;
use OC_Util;
-use OCP\Authentication\TwoFactorAuth\TwoFactorException;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http\TemplateResponse;
+use OCP\Authentication\TwoFactorAuth\TwoFactorException;
use OCP\IRequest;
use OCP\ISession;
use OCP\IURLGenerator;
@@ -116,20 +116,19 @@ class TwoFactorChallengeController extends Controller {
$backupProvider = null;
}
- $error_message = "";
+ $errorMessage = '';
+ $error = false;
if ($this->session->exists('two_factor_auth_error')) {
$this->session->remove('two_factor_auth_error');
$error = true;
- $error_message = $this->session->get("two_factor_auth_error_message");
+ $errorMessage = $this->session->get("two_factor_auth_error_message");
$this->session->remove('two_factor_auth_error_message');
- } else {
- $error = false;
}
$tmpl = $provider->getTemplate($user);
$tmpl->assign('redirect_url', $redirect_url);
$data = [
'error' => $error,
- 'error_message' => $error_message,
+ 'error_message' => $errorMessage,
'provider' => $provider,
'backupProvider' => $backupProvider,
'logout_attribute' => $this->getLogoutAttribute(),
@@ -161,7 +160,7 @@ class TwoFactorChallengeController extends Controller {
if (!is_null($redirect_url)) {
return new RedirectResponse($this->urlGenerator->getAbsoluteURL(urldecode($redirect_url)));
}
- return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index'));
+ return new RedirectResponse(OC_Util::getDefaultPageUrl());
}
} catch (TwoFactorException $e) {
/*
@@ -169,8 +168,7 @@ class TwoFactorChallengeController extends Controller {
* information to the user. The exception text is stored in the
* session to be used in showChallenge()
*/
- $this->session->set('two_factor_auth_error_message',
- $e->getMessage());
+ $this->session->set('two_factor_auth_error_message', $e->getMessage());
}
$this->session->set('two_factor_auth_error', true);