Back

user password recovery

  • 0
  • Flutter
  • Web
  • Accounts
  • Self Hosted
  • Functions
tahakhawaja
27 Jul, 2023, 19:07

How can I fetch an UID based on an email, when the user is logged out? This is so users can recover their password?

In the documentation there is a request called “create password recovery” and “create password recovery confirmation”. The first request requires an email and userid. The second request requires the userid, secret, password, and passwordAgain.

For our current flow, users go to the forgot page link where they enter their email and are sent an email with a redirect link to create a new password. The redirect link prompts them to enter their new password.

The Appwrite documentation requests require a secret and a user Id. So my current question is figuring out how I can generate the userId when they are not logged in? The second question is if a secret is necessary for this process?

TL;DR
- The user is asking about integrating a specific transactional email template using an ID number in the .env file. - They also inquire about configuring an API service using Mailjet and how to combine it with the "createRecovery" request in Appwrite. - The support mentions that SMTP is already configured in Appwrite Cloud and that SMTP env vars need to be configured. - There is no out-of-the-box way to modify the email template in Appwrite, but a modified version can be mounted. - The user asks if Appwrite handles sending emails when using the create recovery function or if a third-party service like Mailjet is needed
Drake
27 Jul, 2023, 19:24

The first request requires an email and userid.

It only requires an email and url 🧐 https://appwrite.io/docs/client/account?sdk=web-default#accountCreateRecovery

For our current flow, users go to the forgot page link where they enter their email and are sent an email with a redirect link to create a new password. The redirect link prompts them to enter their new password.

Correct, this is the exact intended workflow using Appwrite.

So my current question is figuring out how I can generate the userId when they are not logged in?

It's in the URL in the email

The second question is if a secret is necessary for this process?

Yes, of course. That's how Appwrite verifies the user...

tahakhawaja
27 Jul, 2023, 19:25

Is there an additional function that I need to use to be able to generate the secret key?

Drake
27 Jul, 2023, 19:26

no...it's in the URL in the email

tahakhawaja
27 Jul, 2023, 19:28

Okay thank you, and for the first request how can I retrieve the userid? Since the user is not logged in. Is there a certain request or call I can use to get the userid?

Drake
27 Jul, 2023, 19:33

you don't need the user id

tahakhawaja
28 Jul, 2023, 17:07

Quick question for you Steven, does Appwrite handle sending emails when I call the create recovery function, or do I need to integrate a 3rd party servide/tool like mail jet to do that?

Is there also a way to edit and modify the email template so it can look the way we’d like it to look?

Drake
28 Jul, 2023, 17:38

are you on cloud or self-hosted?

tahakhawaja
28 Jul, 2023, 17:43

Self hosted on digital ocean

Drake
28 Jul, 2023, 17:47

then you need to configure the SMTP env vars.

There's no out of hte box way to modify the email template yet. however, you can mount in a modified version of this https://github.com/appwrite/appwrite/blob/master/app/config/locale/templates/email-base.tpl

tahakhawaja
28 Jul, 2023, 18:08

So if the SMTP env vars are configured will it mean that the request "createRecovery" will send out emails with no need for a 3rd party tool or service? Does appwrite take care of this?

Drake
28 Jul, 2023, 18:11

Did you look at the SMTP vars?

tahakhawaja
30 Jul, 2023, 01:50

I had a look, thank you!

Drake
30 Jul, 2023, 02:02

The SMTP provider would be a 3rd party service...

tahakhawaja
30 Jul, 2023, 02:25

Thank you, in that case I’d also like to ask if there is a need for an SMTP provider when Appwrite is self-hosted versus when it is not self-hosted?

Drake
30 Jul, 2023, 02:29

In Appwrite cloud, SMTP is already configured for you

tahakhawaja
30 Jul, 2023, 04:45

Thank you!

tahakhawaja
1 Aug, 2023, 01:15

I have a follow-up question about this. I am using MailJet as a SMTP service to send out emails. In order to configure SMTP I have configured some vars in my .env file. I would like to ask how I can integrate a specific transactional email template if possible using an ID number? Would that be something you have knowledge of? Is there like a var I could enter in the .env file in order to do this?

Additionally, I would like to ask..If I decide to instead of using SMTP, create an API service using Mailjet that I host on a 3rd party service that is accessible by endpoint to send out emails using, how can I configure this with my appwrite, so that my mailjet api call can be combined with the "createRecovery" request, and provide that redirect url link containing the secret key + userid in the mailjet email?

Drake
1 Aug, 2023, 02:02

I'm not sure what you mean by transactional id.

We only support SMTP.

tahakhawaja
1 Aug, 2023, 02:03

Transaction ID is just the template ID on mailjet

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more