Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer is logged in but showing 404 error in frontend. #35838

Closed
ananth-iyer opened this issue Jul 28, 2022 · 28 comments · Fixed by #36263
Closed

Customer is logged in but showing 404 error in frontend. #35838

ananth-iyer opened this issue Jul 28, 2022 · 28 comments · Fixed by #36263
Assignees
Labels
Area: Account Component: LoginAsCustomerFrontendUi Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.x Indicates original Magento version for the Issue report. Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@ananth-iyer
Copy link
Member

ananth-iyer commented Jul 28, 2022

Preconditions and environment

  • 2.3.x, 2.4.x CE and Adobe Commerce

Base64 - aHR0cDovL21hZ2VudG8yNDAubG9jYWwvY3VzdG9tZXIvYWNjb3VudC9sb2dpblBvc3Qv
Decoded Base64 - http://magento240.local/customer/account/loginPost/

Steps to reproduce

  1. Go to frontend.
  2. Add /customer/account/loginPost/ in your magento url. ex-http://magento240.local/customer/account/loginPost/
  3. Now click on {*}S{*}ign In 
  4. Give login id and password.

Expected result

It should generate referer url to Customer dashboard page when referer URL header contains /loginPost.

Actual result

It is not generating referrer url to customer dashboard page,It is showing 404 error page but customer is logged in.

Attached video: Untitled_ Jul 29, 2022 3_00 PM.webm

Additional information

No response

Release note

No response

Triage and priority

  • < > Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • < > Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • < > Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • < > Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • < > Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Jul 28, 2022

Hi @ananth-iyer. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@ananth-iyer
Copy link
Member Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @ananth-iyer. Thank you for your request. I'm working on Magento instance for you.

@engcom-Lima engcom-Lima self-assigned this Jul 28, 2022
@m2-assistant
Copy link

m2-assistant bot commented Jul 28, 2022

Hi @engcom-Lima. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@magento-deployment-service
Copy link

@ananth-iyer
Copy link
Member Author

If you visit this link: https://70b0711c568e9cdf00416449ee01f393.instances.magento-community.engineering/customer/account/loginPost/
Click on Sign In on above link so will get better idea

@engcom-Lima
Copy link
Contributor

engcom-Lima commented Jul 28, 2022

Hi @ananth-iyer

Thanks for your contribution and collaboration.

I have tried to reproduce the issue but unable to reproduce it.
Kindly refer this video for your reference.Also, update your steps to reproduce if something you have missed in it.
If possible please send video of this issue.It will be helpful to us.

Thanks

@engcom-Lima engcom-Lima added the Issue: needs update Additional information is require, waiting for response label Jul 28, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jul 28, 2022
@ananth-iyer
Copy link
Member Author

You did not click this link to replicate the issue - https://70b0711c568e9cdf00416449ee01f393.instances.magento-community.engineering/customer/account/loginPost/

It is clear, you don't want to fix the issue.

@ananth-iyer
Copy link
Member Author

@engcom-Lima ☝🏻

@engcom-Lima
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Lima
Copy link
Contributor

Hi @ananth-iyer ,

I had clicked on above url you have given and I got the 404 error as you described. Further I tried to investigate when we get this url appended with /loginPost.
Inorder to identify the specific scenario I had followed your steps to reproduce and recorded above video.
Can you please help answering whether you are updating url your own or any specific scenario we have to follow to get the url appended with /loginPost?

Thanks

@ananth-iyer
Copy link
Member Author

@engcom-Lima It takes referer url /loginPost, encodes with base64 and adds in referer parameter of /login. So after success login, page is redirected to /loginPost

@ananth-iyer
Copy link
Member Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @ananth-iyer. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@ananth-iyer
Copy link
Member Author

@engcom-Lima check this screen recording
Untitled_ Jul 29, 2022 3_00 PM.webm

@engcom-Lima engcom-Lima changed the title Success re-login with correct password redirects to /loginPost Customer is logged in but showing 404 error in frontend. Jul 29, 2022
@engcom-Lima
Copy link
Contributor

✔️ Issue confirmed

Issue got reproduced in 2.4-develop branch.

Description: Customer is logged in but showing 404 error in the frontend.
Pre-requisite:
Fresh magento 2.4-develop should be installed.

Steps to reproduce:

  1. Go to frontend.
  2. Add /customer/account/loginPost/ in your magento url.
  3. Now click on sign In
  4. Give login id and password.

Expected result:
It should generate referrer url to Customer dashboard page when referer URL header contains /loginPost.

Actual result:
It is not generating referrer url to customer dashboard page,It is showing 404 error page but customer is logged in.

Screenshots:
image

@engcom-Lima engcom-Lima added Area: Account Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Component: LoginAsCustomerFrontendUi Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jul 29, 2022
@m2-community-project m2-community-project bot moved this from Needs Update to Confirmed in Issue Confirmation and Triage Board Jul 29, 2022
@m2-community-project m2-community-project bot removed the Issue: needs update Additional information is require, waiting for response label Jul 29, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-6071 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Jul 29, 2022

✅ Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@sdzhepa sdzhepa added the Priority: P3 May be fixed according to the position in the backlog. label Aug 4, 2022
@m2-community-project m2-community-project bot added this to Ready for Development in Low Priority Backlog Aug 4, 2022
@ananth-iyer
Copy link
Member Author

Hi @engcom-Lima are there any updates?

@engcom-Lima engcom-Lima added Reported on 2.4.x Indicates original Magento version for the Issue report. Reported on 2.3.x Indicates original Magento version for the Issue report. labels Aug 8, 2022
@pmonosolo
Copy link

I have the same issue, its also compounded by Amasty plugin redirecting all 404 pages to search making it confusing as hell.

This is still present on 2.4.5 upgrade from 2.4.3.

I think what happens is that after an unsuccesful login, it loses referrer URL or something similar happens and it just dumps the user to 404 page.

@engcom-Lima
Copy link
Contributor

Hi @pmonosolo & @ananth-iyer ,

Thanks for your contribution and collaboration.

Internal team is working on it ,we will come back soon with some result.

Thanks

@pmonosolo
Copy link

Hi @pmonosolo & @ananth-iyer ,

Thanks for your contribution and collaboration.

Internal team is working on it ,we will come back soon with some result.

Thanks

Thanks @engcom-Lima !

It'd be great if the fix was released as a hotfix instead of waiting for a full release or a patch.

We cant have enterprise software have a serious issue where we lose customers because the basic function such as login does not work.

@Vishrootways
Copy link

We faced a similar issue in our one of the commerce cloud websites and the Adobe support team is not ready to check this so I am also actively looking for a solution.

In our case, the referer URL is incorrectly generated, and due to that customer is not redirecting to the previous page after login.

The issue is the login referer URL miss %2C at the end of the URL.
Correct URL: https://www.our_domain.com/en/customer/account/login/referer/aHR0cHM6Ly93d3cucGFjaWZpY3Ntb2tlLmNvbS9lbi8%2C%2C/

Wrong URL: https://www.our_domain.com/en/customer/account/login/referer/aHR0cHM6Ly93d3cucGFjaWZpY3Ntb2tlLmNvbS9lbi8%2C/

As you can see, the correct URL has %2C at the end, which is missing in the wrong URL. (Basically, correct URL has two %2C%2C but the wrong URL only has one)

If we manually add %2C at the end of the URL, then it works as expected.

Now we are not sure why %2C is missing from the URL.

And the best thing is if we cloned the commerce cloud website to local (with same code and DB) then we have not face any issue :(

Thanks,
Vish

@ananth-iyer
Copy link
Member Author

@engcom-Lima are there any updates?

@andriydeveloper
Copy link

andriydeveloper commented Jul 21, 2023

It happens everywhere where you have an exception during login.
For example, you created a new customer account but did not verify the customer's email. Try to log in and you will get the link with the referer param. Then verify the customer email and finish login using the link with the referer param.
Main bug in the file vendor/magento/module-customer/Model/Url.php, function getLoginUrlParams
It makes referer using urlBuilder from
$referer = $this->urlBuilder->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);
but due to an exception, it generates to own controller: customer/account/loginPost

Quick solution until Magento developers make the right fix:

use Magento\Framework\Url\DecoderInterface;
use Magento\Framework\Url\EncoderInterface;
use Magento\Framework\UrlInterface;

/**
     * Fix Magento bug with customer logged in 404 referer url
     * https://github.com/magento/magento2/issues/35838
     *
     * @param  \Magento\Customer\Model\Url  $subject
     * @param $result
     * @return mixed
     */
    public function afterGetLoginUrlParams(
      \Magento\Customer\Model\Url $subject,
      $result
  ) {
        if(isset($result[\Magento\Customer\Model\Url::REFERER_QUERY_PARAM_NAME])){
          $referer = $result[\Magento\Customer\Model\Url::REFERER_QUERY_PARAM_NAME];
          $refererUrl = $this->urlDecoder->decode($referer);
          if(strpos($refererUrl, 'customer/account/loginPost')){
              $newReferer = $this->urlBuilder->getUrl('customer/account/index', ['_current' => true, '_use_rewrite' => true]);
              $result[\Magento\Customer\Model\Url::REFERER_QUERY_PARAM_NAME] = $this->urlEncoder->encode($newReferer);
          }
      }

      return $result;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Account Component: LoginAsCustomerFrontendUi Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P3 May be fixed according to the position in the backlog. Progress: done Reported on 2.3.x Indicates original Magento version for the Issue report. Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

Successfully merging a pull request may close this issue.

8 participants