redirect to default app after solving the 2FA challenge
This commit is contained in:
parent
bbe8f4ed0d
commit
8c82628622
|
@ -24,6 +24,8 @@
|
||||||
namespace OC\Core\Controller;
|
namespace OC\Core\Controller;
|
||||||
|
|
||||||
use OC\Authentication\TwoFactorAuth\Manager;
|
use OC\Authentication\TwoFactorAuth\Manager;
|
||||||
|
use OC_User;
|
||||||
|
use OC_Util;
|
||||||
use OCP\AppFramework\Controller;
|
use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http\RedirectResponse;
|
use OCP\AppFramework\Http\RedirectResponse;
|
||||||
use OCP\AppFramework\Http\TemplateResponse;
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
@ -67,7 +69,7 @@ class TwoFactorChallengeController extends Controller {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function getLogoutAttribute() {
|
protected function getLogoutAttribute() {
|
||||||
return \OC_User::getLogoutAttribute();
|
return OC_User::getLogoutAttribute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +145,7 @@ class TwoFactorChallengeController extends Controller {
|
||||||
if (!is_null($redirect_url)) {
|
if (!is_null($redirect_url)) {
|
||||||
return new RedirectResponse($this->urlGenerator->getAbsoluteURL(urldecode($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());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->session->set('two_factor_auth_error', true);
|
$this->session->set('two_factor_auth_error', true);
|
||||||
|
|
|
@ -167,13 +167,8 @@ class TwoFactorChallengeControllerTest extends TestCase {
|
||||||
->method('verifyChallenge')
|
->method('verifyChallenge')
|
||||||
->with('myprovider', $user, 'token')
|
->with('myprovider', $user, 'token')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
$this->urlGenerator->expects($this->once())
|
|
||||||
->method('linkToRoute')
|
|
||||||
->with('files.view.index')
|
|
||||||
->will($this->returnValue('files/index/url'));
|
|
||||||
|
|
||||||
$expected = new \OCP\AppFramework\Http\RedirectResponse('files/index/url');
|
$this->assertInstanceOf('\OCP\AppFramework\Http\RedirectResponse', $this->controller->solveChallenge('myprovider', 'token'));
|
||||||
$this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSolveChallengeInvalidProvider() {
|
public function testSolveChallengeInvalidProvider() {
|
||||||
|
|
Loading…
Reference in New Issue