-
Notifications
You must be signed in to change notification settings - Fork 384
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
fix: refactor email sending functions #1495
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
J0
changed the title
fix: push down mailer to sending
fix: initialize mailer only when sending emails
Mar 25, 2024
J0
changed the title
fix: initialize mailer only when sending emails
fix: refactor email sending functions
Mar 25, 2024
kangmingtay
approved these changes
Mar 26, 2024
Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
J0
pushed a commit
that referenced
this pull request
Mar 26, 2024
🤖 I have created a release *beep* *boop* --- ## [2.145.0](v2.144.0...v2.145.0) (2024-03-26) ### Features * add error codes ([#1377](#1377)) ([e4beea1](e4beea1)) * add kakao OIDC ([#1381](#1381)) ([b5566e7](b5566e7)) * clean up expired factors ([#1371](#1371)) ([5c94207](5c94207)) * configurable NameID format for SAML provider ([#1481](#1481)) ([ef405d8](ef405d8)) * HTTP Hook - Add custom envconfig decoding for HTTP Hook Secrets ([#1467](#1467)) ([5b24c4e](5b24c4e)) * refactor PKCE FlowState to reduce duplicate code ([#1446](#1446)) ([b8d0337](b8d0337)) ### Bug Fixes * add http support for https hooks on localhost ([#1484](#1484)) ([5c04104](5c04104)) * cleanup panics due to bad inactivity timeout code ([#1471](#1471)) ([548edf8](548edf8)) * **docs:** remove bracket on file name for broken link ([#1493](#1493)) ([96f7a68](96f7a68)) * impose expiry on auth code instead of magic link ([#1440](#1440)) ([35aeaf1](35aeaf1)) * invalidate email, phone OTPs on password change ([#1489](#1489)) ([960a4f9](960a4f9)) * move creation of flow state into function ([#1470](#1470)) ([4392a08](4392a08)) * prevent user email side-channel leak on verify ([#1472](#1472)) ([311cde8](311cde8)) * refactor email sending functions ([#1495](#1495)) ([285c290](285c290)) * refactor factor_test to centralize setup ([#1473](#1473)) ([c86007e](c86007e)) * refactor mfa challenge and tests ([#1469](#1469)) ([6c76f21](6c76f21)) * Resend SMS when duplicate SMS sign ups are made ([#1490](#1490)) ([73240a0](73240a0)) * unlink identity bugs ([#1475](#1475)) ([73e8d87](73e8d87)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
uxodb
pushed a commit
to uxodb/auth
that referenced
this pull request
Nov 13, 2024
## What kind of change does this PR introduce? The overall goal of this to expose a unified interface for emails. So that we can potentially implement the Hook as a Custom Mailer. This is to ensure that the impact on the existing code flow is minimal and that we can turn off the Hook easily if needed. After this change, we can do something similar to: ``` mailer. := a.Mailer() if a.config.Hook.Enabled { mailer = a.CustomMailer } ``` and have all Hook logic live in the custom Mailer Specific changes are: - Removes context from mailer as it is currently unused - pushes down mailer into respective email sending methods - Adds remaining send methods as API methods - Fetch OTP Length and MaxFrequency from config - Add convenience function for checking if an email was sent within frequency limit - push down `externalURL` and `referrer` into send function --------- Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
uxodb
pushed a commit
to uxodb/auth
that referenced
this pull request
Nov 13, 2024
🤖 I have created a release *beep* *boop* --- ## [2.145.0](supabase/auth@v2.144.0...v2.145.0) (2024-03-26) ### Features * add error codes ([supabase#1377](supabase#1377)) ([e4beea1](supabase@e4beea1)) * add kakao OIDC ([supabase#1381](supabase#1381)) ([b5566e7](supabase@b5566e7)) * clean up expired factors ([supabase#1371](supabase#1371)) ([5c94207](supabase@5c94207)) * configurable NameID format for SAML provider ([supabase#1481](supabase#1481)) ([ef405d8](supabase@ef405d8)) * HTTP Hook - Add custom envconfig decoding for HTTP Hook Secrets ([supabase#1467](supabase#1467)) ([5b24c4e](supabase@5b24c4e)) * refactor PKCE FlowState to reduce duplicate code ([supabase#1446](supabase#1446)) ([b8d0337](supabase@b8d0337)) ### Bug Fixes * add http support for https hooks on localhost ([supabase#1484](supabase#1484)) ([5c04104](supabase@5c04104)) * cleanup panics due to bad inactivity timeout code ([supabase#1471](supabase#1471)) ([548edf8](supabase@548edf8)) * **docs:** remove bracket on file name for broken link ([supabase#1493](supabase#1493)) ([96f7a68](supabase@96f7a68)) * impose expiry on auth code instead of magic link ([supabase#1440](supabase#1440)) ([35aeaf1](supabase@35aeaf1)) * invalidate email, phone OTPs on password change ([supabase#1489](supabase#1489)) ([960a4f9](supabase@960a4f9)) * move creation of flow state into function ([supabase#1470](supabase#1470)) ([4392a08](supabase@4392a08)) * prevent user email side-channel leak on verify ([supabase#1472](supabase#1472)) ([311cde8](supabase@311cde8)) * refactor email sending functions ([supabase#1495](supabase#1495)) ([285c290](supabase@285c290)) * refactor factor_test to centralize setup ([supabase#1473](supabase#1473)) ([c86007e](supabase@c86007e)) * refactor mfa challenge and tests ([supabase#1469](supabase#1469)) ([6c76f21](supabase@6c76f21)) * Resend SMS when duplicate SMS sign ups are made ([supabase#1490](supabase#1490)) ([73240a0](supabase@73240a0)) * unlink identity bugs ([supabase#1475](supabase#1475)) ([73e8d87](supabase@73e8d87)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
LashaJini
pushed a commit
to LashaJini/auth
that referenced
this pull request
Nov 13, 2024
## What kind of change does this PR introduce? The overall goal of this to expose a unified interface for emails. So that we can potentially implement the Hook as a Custom Mailer. This is to ensure that the impact on the existing code flow is minimal and that we can turn off the Hook easily if needed. After this change, we can do something similar to: ``` mailer. := a.Mailer() if a.config.Hook.Enabled { mailer = a.CustomMailer } ``` and have all Hook logic live in the custom Mailer Specific changes are: - Removes context from mailer as it is currently unused - pushes down mailer into respective email sending methods - Adds remaining send methods as API methods - Fetch OTP Length and MaxFrequency from config - Add convenience function for checking if an email was sent within frequency limit - push down `externalURL` and `referrer` into send function --------- Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
LashaJini
pushed a commit
to LashaJini/auth
that referenced
this pull request
Nov 13, 2024
🤖 I have created a release *beep* *boop* --- ## [2.145.0](supabase/auth@v2.144.0...v2.145.0) (2024-03-26) ### Features * add error codes ([supabase#1377](supabase#1377)) ([e4beea1](supabase@e4beea1)) * add kakao OIDC ([supabase#1381](supabase#1381)) ([b5566e7](supabase@b5566e7)) * clean up expired factors ([supabase#1371](supabase#1371)) ([5c94207](supabase@5c94207)) * configurable NameID format for SAML provider ([supabase#1481](supabase#1481)) ([ef405d8](supabase@ef405d8)) * HTTP Hook - Add custom envconfig decoding for HTTP Hook Secrets ([supabase#1467](supabase#1467)) ([5b24c4e](supabase@5b24c4e)) * refactor PKCE FlowState to reduce duplicate code ([supabase#1446](supabase#1446)) ([b8d0337](supabase@b8d0337)) ### Bug Fixes * add http support for https hooks on localhost ([supabase#1484](supabase#1484)) ([5c04104](supabase@5c04104)) * cleanup panics due to bad inactivity timeout code ([supabase#1471](supabase#1471)) ([548edf8](supabase@548edf8)) * **docs:** remove bracket on file name for broken link ([supabase#1493](supabase#1493)) ([96f7a68](supabase@96f7a68)) * impose expiry on auth code instead of magic link ([supabase#1440](supabase#1440)) ([35aeaf1](supabase@35aeaf1)) * invalidate email, phone OTPs on password change ([supabase#1489](supabase#1489)) ([960a4f9](supabase@960a4f9)) * move creation of flow state into function ([supabase#1470](supabase#1470)) ([4392a08](supabase@4392a08)) * prevent user email side-channel leak on verify ([supabase#1472](supabase#1472)) ([311cde8](supabase@311cde8)) * refactor email sending functions ([supabase#1495](supabase#1495)) ([285c290](supabase@285c290)) * refactor factor_test to centralize setup ([supabase#1473](supabase#1473)) ([c86007e](supabase@c86007e)) * refactor mfa challenge and tests ([supabase#1469](supabase#1469)) ([6c76f21](supabase@6c76f21)) * Resend SMS when duplicate SMS sign ups are made ([supabase#1490](supabase#1490)) ([73240a0](supabase@73240a0)) * unlink identity bugs ([supabase#1475](supabase#1475)) ([73e8d87](supabase@73e8d87)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
LashaJini
pushed a commit
to LashaJini/auth
that referenced
this pull request
Nov 15, 2024
## What kind of change does this PR introduce? The overall goal of this to expose a unified interface for emails. So that we can potentially implement the Hook as a Custom Mailer. This is to ensure that the impact on the existing code flow is minimal and that we can turn off the Hook easily if needed. After this change, we can do something similar to: ``` mailer. := a.Mailer() if a.config.Hook.Enabled { mailer = a.CustomMailer } ``` and have all Hook logic live in the custom Mailer Specific changes are: - Removes context from mailer as it is currently unused - pushes down mailer into respective email sending methods - Adds remaining send methods as API methods - Fetch OTP Length and MaxFrequency from config - Add convenience function for checking if an email was sent within frequency limit - push down `externalURL` and `referrer` into send function --------- Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
LashaJini
pushed a commit
to LashaJini/auth
that referenced
this pull request
Nov 15, 2024
🤖 I have created a release *beep* *boop* --- ## [2.145.0](supabase/auth@v2.144.0...v2.145.0) (2024-03-26) ### Features * add error codes ([supabase#1377](supabase#1377)) ([e4beea1](supabase@e4beea1)) * add kakao OIDC ([supabase#1381](supabase#1381)) ([b5566e7](supabase@b5566e7)) * clean up expired factors ([supabase#1371](supabase#1371)) ([5c94207](supabase@5c94207)) * configurable NameID format for SAML provider ([supabase#1481](supabase#1481)) ([ef405d8](supabase@ef405d8)) * HTTP Hook - Add custom envconfig decoding for HTTP Hook Secrets ([supabase#1467](supabase#1467)) ([5b24c4e](supabase@5b24c4e)) * refactor PKCE FlowState to reduce duplicate code ([supabase#1446](supabase#1446)) ([b8d0337](supabase@b8d0337)) ### Bug Fixes * add http support for https hooks on localhost ([supabase#1484](supabase#1484)) ([5c04104](supabase@5c04104)) * cleanup panics due to bad inactivity timeout code ([supabase#1471](supabase#1471)) ([548edf8](supabase@548edf8)) * **docs:** remove bracket on file name for broken link ([supabase#1493](supabase#1493)) ([96f7a68](supabase@96f7a68)) * impose expiry on auth code instead of magic link ([supabase#1440](supabase#1440)) ([35aeaf1](supabase@35aeaf1)) * invalidate email, phone OTPs on password change ([supabase#1489](supabase#1489)) ([960a4f9](supabase@960a4f9)) * move creation of flow state into function ([supabase#1470](supabase#1470)) ([4392a08](supabase@4392a08)) * prevent user email side-channel leak on verify ([supabase#1472](supabase#1472)) ([311cde8](supabase@311cde8)) * refactor email sending functions ([supabase#1495](supabase#1495)) ([285c290](supabase@285c290)) * refactor factor_test to centralize setup ([supabase#1473](supabase#1473)) ([c86007e](supabase@c86007e)) * refactor mfa challenge and tests ([supabase#1469](supabase#1469)) ([6c76f21](supabase@6c76f21)) * Resend SMS when duplicate SMS sign ups are made ([supabase#1490](supabase#1490)) ([73240a0](supabase@73240a0)) * unlink identity bugs ([supabase#1475](supabase#1475)) ([73e8d87](supabase@73e8d87)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
The overall goal of this to expose a unified interface for emails. So that we can potentially implement the Hook as a Custom Mailer. This is to ensure that the impact on the existing code flow is minimal and that we can turn off the Hook easily if needed.
After this change, we can do something similar to:
and have all Hook logic live in the custom Mailer
Specific changes are:
externalURL
andreferrer
into send function