Skip to content
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: do call send sms hook when SMS autoconfirm is enabled #1562

Merged
merged 4 commits into from
May 1, 2024

Conversation

J0
Copy link
Contributor

@J0 J0 commented Apr 30, 2024

What kind of change does this PR introduce?

Small quirk discovered while testing - it currently looks like when SMS Autoconfirm is set

 GOTRUE_SMS_AUTOCONFIRM="true" 

and an OTP request is made:

curl -X POST http://localhost:9999/otp -H "Content-Type: application/json" -d '{"phone": "<phone>"}'

an OTP is still sent. There's a substantial number projects (see internal for exact number) using this so probably will preserve this behaviour.

This affects the edge case where SMS_AUTOCONFIRM is enabled but the Hook returns an error which may leave the developer puzzled since one might expect an SMS not to be sent with autoconfirm similar to MAILER_AUTOCONFIRM

Before:

  • Enable Send SMS and autoconfirm, make a request with faulty URI - request should fail

After:

  • Enable Send SMS and autoconfirm, make a request - message is sent as per current behaviour

@coveralls
Copy link

coveralls commented Apr 30, 2024

Pull Request Test Coverage Report for Build 8906535523

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 65.704%

Totals Coverage Status
Change from base Build 8897848724: 0.0%
Covered Lines: 8209
Relevant Lines: 12494

💛 - Coveralls

@J0 J0 changed the title fix: don't call hook when SMS autoconfirm is enabled fix: don't send an SMS when SMS autoconfirm is enabled Apr 30, 2024
@J0 J0 changed the title fix: don't send an SMS when SMS autoconfirm is enabled fix: do not send an SMS when SMS autoconfirm is enabled Apr 30, 2024
@J0 J0 force-pushed the j0/fixes_while_testing branch from 73e1e43 to 1008344 Compare May 1, 2024 06:56
@J0 J0 marked this pull request as ready for review May 1, 2024 06:56
@J0 J0 requested a review from a team as a code owner May 1, 2024 06:56
@J0 J0 changed the title fix: do not send an SMS when SMS autoconfirm is enabled fix: do call send sms hook when SMS autoconfirm is enabled May 1, 2024
internal/api/phone.go Outdated Show resolved Hide resolved
Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
@J0 J0 merged commit bfe4d98 into master May 1, 2024
2 checks passed
@J0 J0 deleted the j0/fixes_while_testing branch May 1, 2024 07:12
hf pushed a commit that referenced this pull request May 3, 2024
## What kind of change does this PR introduce?

Small quirk discovered while testing - it currently looks like when SMS
Autoconfirm is set
```
 GOTRUE_SMS_AUTOCONFIRM="true"
```

 and an OTP request is made:

```
curl -X POST http://localhost:9999/otp -H "Content-Type: application/json" -d '{"phone": "<phone>"}'
```
an OTP is still sent. There's a substantial number projects (see
internal for exact number) using this so probably will preserve this
behaviour.

This affects the edge case where `SMS_AUTOCONFIRM` is enabled but the
Hook returns an error which may leave the developer puzzled since one
might expect an SMS not to be sent with autoconfirm similar to
`MAILER_AUTOCONFIRM`

Before:
- Enable Send SMS and autoconfirm, make a request with faulty URI -
request should fail

After:
- Enable Send SMS and autoconfirm, make a request - message is sent as
per current behaviour

---------

Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
hf pushed a commit that referenced this pull request May 6, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.151.0](v2.150.1...v2.151.0)
(2024-05-06)


### Features

* refactor one-time tokens for performance
([#1558](#1558))
([d1cf8d9](d1cf8d9))


### Bug Fixes

* do call send sms hook when SMS autoconfirm is enabled
([#1562](#1562))
([bfe4d98](bfe4d98))
* format test otps
([#1567](#1567))
([434a59a](434a59a))
* log final writer error instead of handling
([#1564](#1564))
([170bd66](170bd66))

---
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants