StevonStevoff / ProjectParsnip

A IoT Project for Managing At-Home Smart Farming
3 stars 0 forks source link

Verify email #69

Closed sc19sjjd closed 1 year ago

sc19sjjd commented 1 year ago

Using the auth/request-verify-token and auth/forgot-password routes now send an email to the user which includes a link and token depending on which route is used. Still a little more to be done to make the emails look nicer but this can be done after a firm style has been established on the frontend.

More importantly we need to decide where the links should lead the user to. Currently they go to a non-existent route (I was working on this until I realised there were built in ones from the fastapi-users library). Currently the links can't be used to go directly to the auth/verify and auth/reset-password routes because they are both post requests with the token provided in the body rather than the link itself. There were 3 ideas that I thought of which could work (but if you can think of a better solution that would be good) which I will put in the discord.

Also at this point authentication.py contains a verify-token function which is not in use, this was made before I realised that there was already a verify route from fastapi-users. Can remove the file later but at this point I've kept it in incase we do things with jwt tokens in where this could be used as a reference.

StevonStevoff commented 1 year ago

If you update your project.toml file with the one from my secrets branch, that should fix the current error

StevonStevoff commented 1 year ago

If you update your project.toml file with the one from my secrets branch, that should fix the current error

Also for future reference, when you add a new package, add it with poetry add <package name> And it'll be added to the virtual environment automatically

sc19sjjd commented 1 year ago

Ah ok I'll also do that, thanks.

sc19sjjd commented 1 year ago

@StevonStevoff I think MAIL_USERNAME, MAIL_PASSWORD and MAIL_EMAIL all need to be set also in .env file or github secrets for it to work. Also have a dependency issue when trying to add fastapi-mail with poetry add: image