Skip to content

Commit

Permalink
Merge pull request #16 from YouweGit/feature/set-before-2fa-url
Browse files Browse the repository at this point in the history
set before auth url
  • Loading branch information
kaplansin authored Dec 29, 2023
2 parents eb54132 + e166372 commit 06be826
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Plugin/AccountRedirectPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@ public function __construct(private readonly CustomerSession $customerSession)
{
}

public function beforeGetRedirect(Redirect $subject): array
{
$beforeAuthUrl = $this->session->getBeforeAuthUrl(false);
if ($beforeAuthUrl) {
$this->customerSession->setBefore2faUrl($beforeAuthUrl);
}

return [];
}

public function afterGetRedirectCookie(Redirect $subject, ?string $result): ?string
{
if ($result && !$this->customerSession->getBefore2faUrl(false)) {
if ($result) {
$this->customerSession->setBefore2faUrl($result);
}

Expand Down
2 changes: 1 addition & 1 deletion Plugin/LoginPostPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(
public function afterExecute(LoginPost $subject, Redirect $result): Redirect
{
if (!$this->config->isEnabled()) {
return $this;
return $result;
}

if ($this->customerSession->get2faSuccessful()) {
Expand Down

0 comments on commit 06be826

Please sign in to comment.