move webauthn check to deeper implemented login method

This commit is contained in:
Daniel Seifert 2022-11-08 22:47:11 +01:00
parent 64f974d486
commit 2bf7399aa4
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
2 changed files with 12 additions and 12 deletions

View File

@ -33,13 +33,13 @@ use Psr\Container\NotFoundExceptionInterface;
class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
{
/**
* @return string|void
* @return string
* @throws ContainerExceptionInterface
* @throws Exception
* @throws NotFoundExceptionInterface
* @throws DoctrineDriverException
*/
public function login_noredirect()
public function login()
{
$lgn_user = Registry::getRequest()->getRequestParameter('lgn_usr');
$password = Registry::getRequest()->getRequestParameter('lgn_pwd');
@ -70,11 +70,12 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
$this->getParent()->getViewConfig()->getNavFormParams()
);
return "d3webauthnlogin";
$sUrl = $this->getConfig()->getShopHomeUrl() . 'cl=d3webauthnlogin';
Registry::getUtils()->redirect($sUrl, true, 302);
}
}
parent::login_noredirect();
return parent::login();
}
/**
@ -102,7 +103,7 @@ class d3_webauthn_UserComponent extends d3_webauthn_UserComponent_parent
* @param User $user
* @param $sWebauthn
*/
public function d3WebauthnRelogin(User $user, $sWebauthn): void
protected function d3WebauthnRelogin(User $user, $sWebauthn): void
{
$setSessionCookie = Registry::getRequest()->getRequestParameter('lgn_cook');
$this->d3GetSession()->setVariable(WebauthnConf::WEBAUTHN_SESSION_AUTH, $sWebauthn);

View File

@ -86,11 +86,10 @@ class passwordFrontendAuthTest extends integrationTestCase
$controller->init();
/** @var d3_webauthn_UserComponent $component */
$component = $controller->getComponent('oxcmp_user');
$component->login_noredirect();
$this->assertSame(
$expected,
$component->getLoginStatus()
$component->login()
);
$component->logout();
@ -102,11 +101,11 @@ class passwordFrontendAuthTest extends integrationTestCase
public function loginDataProvider(): array
{
return [
'not existing account' => ['unknown@user.localhost', '123456', USER_LOGIN_FAIL],
'missing password' => ['noadmin@user.localhost', null, USER_LOGIN_FAIL],
'inactive account' => ['inactive@user.localhost', '123456', USER_LOGIN_FAIL],
'wrong shop account' => ['wrongshop@user.localhost', '123456', USER_LOGIN_FAIL],
'account ok' => ['noadmin@user.localhost', '123456', USER_LOGIN_SUCCESS],
'not existing account' => ['unknown@user.localhost', '123456', 'user'],
'missing password' => ['noadmin@user.localhost', null, 'user'],
'inactive account' => ['inactive@user.localhost', '123456', 'user'],
'wrong shop account' => ['wrongshop@user.localhost', '123456', 'user'],
'account ok' => ['noadmin@user.localhost', '123456', 'payment'],
];
}
}