supabase / supabase

The open source Firebase alternative. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
https://supabase.com
Apache License 2.0
73.99k stars 7.18k forks source link

This button doesn't always send the "Magic Link" template #27475

Open saltcod opened 5 months ago

saltcod commented 5 months ago

Discussed in https://github.com/orgs/supabase/discussions/27425

Originally posted by **askkaz** June 20, 2024 We have walked a lot of Supabase users through setting up their auth emails and it is frequently a source of confusion that this button: Screenshot 2024-06-20 at 12 44 40 PM sends the "Confirm signup" template if the user has not yet confirmed their email and not the "Magic Link" template. Screenshot 2024-06-20 at 12 45 08 PM I think it would help users getting started if the initial menu was context aware enough to display the correct option ("confirm signup"). bonus nit - template names should match, see "password recovery" vs. "reset password" double bonus nit - email template tab names should all match casing ("Confirm signup" vs "Magic Link")
Unique-Usman commented 4 months ago

Hello, I am interested in Supabase project and would like to make contributions. I think I can start with this. I already cloned the repo. Can I work on it ? Thank.

Hallidayo commented 4 months ago

Hi @Unique-Usman - Absolutely! feel free to open a pull request 👍

Unique-Usman commented 4 months ago

Hello @Hallidayo, thanks for the reply. I have been able to build and setup the project. While the issue is good first issue, I will be glad if some of my doubt can be answered. Thank you.

  1. I was able to figure out that, this component is the one rendering the button "⋮" https://github.com/supabase/supabase/blob/master/apps/studio/components/interfaces/Auth/Users/UserDropdown.tsx

  2. While doing going through the code base, I was able to detect the code that is rendering the UserDropdown.tsx https://github.com/supabase/supabase/blob/master/apps/studio/components/interfaces/Auth/Users/UsersListItem.tsx

I noticed it is possible to check if the user is already confirmed from this line https://github.com/supabase/supabase/blob/master/apps/studio/components/interfaces/Auth/Users/UsersListItem.tsx#L29

I think I can either passed the isUserConfirmed to the UserDropdown.tsx component or create another derive state inside the UserDropdown.tsx as it is derived from UsersListItem.tsx and then render the text inside https://github.com/supabase/supabase/blob/master/apps/studio/components/interfaces/Auth/Users/UserDropdown.tsx#L160 using the state.

  1. For the two bonuses. I think, I was able to locate the part that renders them https://github.com/supabase/supabase/blob/master/apps/studio/components/interfaces/Auth/AuthTemplatesValidation.tsx

If I get the first bonus part, this line https://github.com/supabase/supabase/blob/master/apps/studio/components/interfaces/Auth/AuthTemplatesValidation.tsx#L151 should be Password Recovery

For the second bonus, I think using the "Magic Link" format is okay.

Though, I was able to build the project on my local system. I need a little guidance on recognising on how I can get to this pages.

Thank you.

hkrhemendra commented 4 months ago

Hi @Hallidayo, I am looking for my open source contribution. Can I pick this issue?

Unique-Usman commented 4 months ago

@hkrhemendra, I think you did not read the previous conversation, I am already working on this issue, I think there are couples of other good first issues on the issue tracker list.

Hallidayo commented 4 months ago

Hi @Unique-Usman - Thank you for taking a look into this one.

Yep thats the correct component to use. I think its good to just have the one item displayed so if the user is awaiting an invite the button should be:

Send Invite Link

If the user is confirmed then the default button should be displayed:

Send Magic Link

For the headings in the Email Templates that is the correct file. Its the title key in each object that needs to be checked. Its probably best to uppercase the start of each word so Invite user to Invite User.

Are you able to view the Email Templates locally?

Unique-Usman commented 4 months ago

@Hallidayo, thanks for your reply. I was unable to view the Email Template Locally, I could not figure out the link.

Is it Send Invite Link or Confirm SignUp Link. Also the user can be checked if already confirmed through const isUserConfirmed = user.email_confirmed_at || user.phone_confirmed_at, in this scenerio, we just havae to check for the user.email_confirmed_at ?

Hallidayo commented 4 months ago

@Unique-Usman - If you go to http://localhost:8082/project/default/auth/templates you should then get the templates showing for you locally.

Sorry yes it should be Confirm Sign Up Link.

Yeah you should be able to use the isUserConfirmed constant to switch between the two items.

Feel free to reach out if you need anything!

Unique-Usman commented 4 months ago

@Hallidayo, I have a first PR for the resolvement of the issues https://github.com/supabase/supabase/pull/27759, kindly check thank you.

sarthakvijayvargiya commented 1 week ago

Hi , Is this open , Can i work on this