scottyzen / woonuxt

Static e-commerce powered by WooCommerce & Nuxt
https://woonuxt.com
GNU General Public License v3.0
685 stars 190 forks source link

Password reset link is invalid #244

Closed grandant closed 2 months ago

grandant commented 2 months ago

Hi, thanks for the great work.

I am testing with:

Whenever I try to test the password reset functionality I get:

Password reset link is invalid.[Please request a new link](https://rondo-frontend-test.nuxt.dev/my-account?action=forgotPassword)

image

There aren't any errors in the dev console or anywhere else that I can see.

alexookah commented 2 months ago

Interesting! @grandant

I did some work to make this work actually in woocommerce codebase (PR).

Today September 10 is the release of 9.3 which should contain my change. The change is that the reset link contains the username (called "login") which is required for the reset password to happen. Thats why you are getting this error!

Please try again with the 9.3 release of woocommerce once released and let me know if it worked!

Out of curiosity:

  1. Did you get the Woocommerce Reset Email Email template?
  2. How did you get the reset password link to headless woonuxt website? (did you use some plugin like: Simple Website Redirect or did you change the Site Address (URL) in wordpress Settings? By
grandant commented 2 months ago

Glad to hear that! I don't have any experience with WordPress but after a lot of trials I realized that the issue was exactly that. So I edited reset password template and I had to hard-code the production URL. So everything is working now. I realize this is less than ideal so I am looking forward to test your update.

  1. Yes - I directly changed the template if that's your question
  2. I hardcoded the Site Address into the template

I made some other changes as well to ensure that the WP Address and Site Address work separately.

There were several other issues as well. Maybe some of them are due to my very limited knowledge of WordPress configuration but if you are interested I can share my findings.

alexookah commented 2 months ago

Well if you have edited the template then you might need to re-edit it and include the login parameter. Unless it gets overwritten once you update woocommerce to 9.3. In my setup I found that using the pluginSimple Website Redirect worked fine. Simply all wordpress front-end urls are redirecting to the headless website. So no need to edit any template.

https://wordpress.org/plugins/simple-website-redirect/

Screenshot 2024-09-10 at 10 44 51

Exclude Query Parameters: download_file,wc-api,graphql,wc-ajax Exclude Paths: /graphql,/wp-json,/wc-auth

So if email link is: https://shop.comewithreverse.com/my-account/lost-password/?key=asd21eadadsasdas&login=alexookah

after user trying to open the link he would go to https://comewithreverse.com/my-account/lost-password?key=asd21eadadsasdas&login=alexookah

It's less hassle this way because you would need to edit also other Woocommerce emails like product links, order completed. e.t.c.

I also think this plugin should be recommended for Woonuxt from WoonuxtSettings plugin. WDYT @scottyzen ?

grandant commented 2 months ago

Thanks, that works good. It's important to have the WordPress installed in the root directory to avoid additional configuration. I re-installed everything so it's a clean install now. Just waiting for the WooCommerce update to be released to see if the login credentials will be included in the password reset link.

alexookah commented 2 months ago

Woocommerce 9.3.1 got released today and seems the username is provided in the reset link. Check it out @grandant

grandant commented 2 months ago

Yep, the issue is resolved. Thanks for the help @alexookah