dominic-ks / bdvs-password-reset

WordPress - Allow users to reset their password using a random code via the REST API
GNU General Public License v3.0
9 stars 3 forks source link

Add possibility of adding params to the endpoint #19

Closed alinademi closed 2 years ago

alinademi commented 2 years ago

@dominic-ks this plugin is awesome and addresses a big pain point on wp rest API usage. Thanks for the nice work.

The issue has been raised as we are building a headless app and I need to:

  1. Check if the request has a certain param then it means that is the app making the request, not the website.
  2. If it is mobile, hijack the password reset link in the email template and preg_replace() the https:// part with the App:// deep link so that it opens the app from the email.

Is there anything from the docs that already makes it possible and missed?

dominic-ks commented 2 years ago

Hey @alinademi, thanks for the kind words, I appreciate it.

In terms of what's in the plugin right now, there is the bdpwr_code_email_text that allows you to change the text that is sent in the email containing the code, but, this email doesn't contain a link by default, since part of the point of the plugin was to avoid needing to deal with the URL that the default WordPress password reset email sends.

I wrote some more detail on the context of this here:

I'm guessing potentially you are adding a link to the email using the filters, or perhaps you're talking about the WordPress email, either way there's nothing currently in the plugin that specifically gives the opportunity for other data or some sort of context to be sent with the request.

Without trying it you may be able to include a custom header containing the context of your request and then filter the context of an email depending on the value that it contains.

Either that or you could look into implementing deep links for your website / app, which is where the device automatically opens a website's related app when visiting a website link, if it's installed, which really I think is the best option for what you've described, but, when I looked into this before I decided it'd be easier to develop this plugin instead...

alinademi commented 2 years ago

It would be ideal to be able to send extra info with the request. I guess we will add a header, then check for it and modify the email template accordingly. Thanks for the suggestions and clarification.