-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add custom email sender hook #1496
Conversation
8468da5
to
f1d5e9a
Compare
Pull Request Test Coverage Report for Build 8520521705Details
💛 - Coveralls |
output := hooks.CustomEmailProviderOutput{} | ||
err = a.invokeHTTPHook(ctx, r, &input, &output, config.Hook.CustomEmailProvider.URI) | ||
currentEmail := u.GetEmail() | ||
if config.Mailer.SecureEmailChangeEnabled && currentEmail != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can potentially merge the two invocations into one by adding additional parameters though that makes handling on the function slightly more cumbersome as there's a need to check for two different paramers otp
and newOTP
or similar.
Going to add RedirectTo and Data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some improvements needed...
c636931
to
da18f75
Compare
da18f75
to
283f791
Compare
## What kind of change does this PR introduce? Moves the mail related refactors from #1496 into a new PR so the hook related PR is easier to review. This PR moves all EmailActionTypes to mailer package to establish an explicit link between mailer and the packages it is used in. The changes are cosmetic and should not affect underlying functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far! Please fix the nits to align the wording... we should maybe do the same for the SMS one too while it's not fully released yet
var err error | ||
|
||
if response, err = a.runHTTPHook(ctx, r, a.config.Hook.SendEmail, input, output); err != nil { | ||
return internalServerError("Error invoking custom email provider hook.").WithInternalError(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message should use "send email hook" wording
@@ -452,6 +452,7 @@ type HookConfiguration struct { | |||
PasswordVerificationAttempt ExtensibilityPointConfiguration `json:"password_verification_attempt" split_words:"true"` | |||
CustomAccessToken ExtensibilityPointConfiguration `json:"custom_access_token" split_words:"true"` | |||
CustomSMSProvider ExtensibilityPointConfiguration `json:"custom_sms_provider" split_words:"true"` | |||
SendEmail ExtensibilityPointConfiguration `json:"custom_email_provider" split_words:"true"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update JSON tag
Ah Apologies should have closed this - I actually opened a new PR #1512 as it was easier to refactor starting from scratch. We can adjust the wording from |
## What kind of change does this PR introduce? We are renaming `CustomEmailProvider` to `SendEmail`. For consistency, I guess we should rename `CustomSMSProvider` to `SendSMS`. More context in #1496 This should be fine since [the PR to add env configs for this hook](https://github.com/supabase/infrastructure/pull/17604) has not landed in prod
## What kind of change does this PR introduce? The send email hook serves as a substitute for the default email client (e.g. GoMail) across all endpoints. Supercedes #1496 as it was simpler to visualize the PR when starting from scratch
## What kind of change does this PR introduce? Moves the mail related refactors from supabase#1496 into a new PR so the hook related PR is easier to review. This PR moves all EmailActionTypes to mailer package to establish an explicit link between mailer and the packages it is used in. The changes are cosmetic and should not affect underlying functionality.
## What kind of change does this PR introduce? We are renaming `CustomEmailProvider` to `SendEmail`. For consistency, I guess we should rename `CustomSMSProvider` to `SendSMS`. More context in supabase#1496 This should be fine since [the PR to add env configs for this hook](https://github.com/supabase/infrastructure/pull/17604) has not landed in prod
## What kind of change does this PR introduce? The send email hook serves as a substitute for the default email client (e.g. GoMail) across all endpoints. Supercedes supabase#1496 as it was simpler to visualize the PR when starting from scratch
## What kind of change does this PR introduce? Moves the mail related refactors from supabase#1496 into a new PR so the hook related PR is easier to review. This PR moves all EmailActionTypes to mailer package to establish an explicit link between mailer and the packages it is used in. The changes are cosmetic and should not affect underlying functionality.
## What kind of change does this PR introduce? We are renaming `CustomEmailProvider` to `SendEmail`. For consistency, I guess we should rename `CustomSMSProvider` to `SendSMS`. More context in supabase#1496 This should be fine since [the PR to add env configs for this hook](https://github.com/supabase/infrastructure/pull/17604) has not landed in prod
## What kind of change does this PR introduce? The send email hook serves as a substitute for the default email client (e.g. GoMail) across all endpoints. Supercedes supabase#1496 as it was simpler to visualize the PR when starting from scratch
## What kind of change does this PR introduce? Moves the mail related refactors from supabase#1496 into a new PR so the hook related PR is easier to review. This PR moves all EmailActionTypes to mailer package to establish an explicit link between mailer and the packages it is used in. The changes are cosmetic and should not affect underlying functionality.
## What kind of change does this PR introduce? We are renaming `CustomEmailProvider` to `SendEmail`. For consistency, I guess we should rename `CustomSMSProvider` to `SendSMS`. More context in supabase#1496 This should be fine since [the PR to add env configs for this hook](https://github.com/supabase/infrastructure/pull/17604) has not landed in prod
## What kind of change does this PR introduce? The send email hook serves as a substitute for the default email client (e.g. GoMail) across all endpoints. Supercedes supabase#1496 as it was simpler to visualize the PR when starting from scratch
What kind of change does this PR introduce?
Adds a custom email sender at an API layer. Hook invocation happens on the API so the abstraction is done at the API level instead of on the
mailer
to avoid having themailer
import API.The custom hook email sender serves as a substitute for the default email sender across all endpoints. It is not possible to selectively enable the hook on certain email flows.