timothymiller / t4-app

A powerful cross-platform UI toolkit for building actually native iOS, Android, macOS, Windows, Linux, and Progressive Web Apps with React (Native).
https://t4stack.com
MIT License
1.3k stars 67 forks source link

Lucia branch: Suggestion: Send email after successful sign up #132

Open Boscop opened 6 months ago

Boscop commented 6 months ago

Currently the user receives no email when signing up successfully. Suggestion: Send email to user after successful sign up.

rmarscher commented 6 months ago

I sort of intentionally left it open for the developer using this starter project to implement email or sms notifications on their own because it's opinionated. You need to decide what provider to use and what you want to include in the email. You also might want to require email verification before you allow access. I added one email example for sending a password reset email via Resend. https://github.com/timothymiller/t4-app/blob/lucia/packages/api/src/auth/user.ts#L205-L223

Boscop commented 6 months ago

Ah yeah. Can we add code that sends an email with a verification link if the user signs up with email instead of oauth? :) Since it's very common to have such an email after sign up. (And unnecessary when the user signed up via oauth because that provider already asked them to verify their email address when they signed up there.) I think it would make sense to have this in the lucia branch/template.

(I'm using Resend for now, but the email sending logic could stay the same regardless of the actual provider that people will use.)

timothymiller commented 6 months ago

Ah yeah. Can we add code that sends an email with a verification link if the user signs up with email instead of oauth? :) Since it's very common to have such an email after sign up. (And unnecessary when the user signed up via oauth because that provider already asked them to verify their email address when they signed up there.) I think it would make sense to have this in the lucia branch/template.

(I'm using Resend for now, but the email sending logic could stay the same regardless of the actual provider that people will use.)

I agree with this. I will implement a PR.

rmarscher commented 6 months ago

@timothymiller FYI here are the new docs getting created around email verification for lucia v3 - https://v3.lucia-auth.com/guides/email-and-password/email-verification-codes