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

feature: notifications #9

Merged
merged 20 commits into from
Sep 19, 2024
Merged

feature: notifications #9

merged 20 commits into from
Sep 19, 2024

Conversation

lucasmenendez
Copy link
Contributor

@lucasmenendez lucasmenendez commented Sep 9, 2024

User notifications to verify email addresses or invite new admins to an organization. Via SMS and email.

Includes a testing email service. Support for no email service definition on boot allowing to verify users without code.

Now, when a new user registers, the account is created as unverified and the user receives a verification email. A new endpoint has been created to verify a user's account based on the user's email and the code sent.

There are also two new endpoints to request a user password recovery, which sends a code to the email provided to recover the associated password and reset the user password with that code.

@lucasmenendez lucasmenendez added the enhancement New feature or request label Sep 9, 2024
@lucasmenendez lucasmenendez self-assigned this Sep 9, 2024
@lucasmenendez lucasmenendez marked this pull request as ready for review September 13, 2024 06:58
@lucasmenendez lucasmenendez marked this pull request as draft September 13, 2024 09:33
@lucasmenendez lucasmenendez marked this pull request as draft September 13, 2024 09:33
@lucasmenendez lucasmenendez marked this pull request as ready for review September 16, 2024 07:57
Copy link
Member

@emmdim emmdim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally please change the random hex for a TOTP as discussed

db/users.go Outdated Show resolved Hide resolved
db/users.go Outdated Show resolved Hide resolved
db/verifications.go Outdated Show resolved Hide resolved
db/verifications.go Outdated Show resolved Hide resolved
notifications/twilio/sms.go Outdated Show resolved Hide resolved
api/types.go Show resolved Hide resolved
cmd/service/main.go Outdated Show resolved Hide resolved
Copy link
Member

@emmdim emmdim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally please change the random hex for a TOTP as discussed

…to include some internal helpers like email format verification, password hashing or random generation
docker-compose.yml Show resolved Hide resolved
api/helpers.go Outdated Show resolved Hide resolved
internal/utils.go Show resolved Hide resolved
@lucasmenendez lucasmenendez merged commit b651ae1 into main Sep 19, 2024
6 checks passed
@lucasmenendez lucasmenendez deleted the f/notifications branch September 20, 2024 09:57
selankon added a commit to vocdoni/ui-scaffold that referenced this pull request Sep 20, 2024
Depends on vocdoni/saas-backend#9 and needs #765

It implements the email verification page. 

- On signup page, once signup is success it shows an "verification email sent" message with a "resend email button"
- On login page if the error of the backend is that the email is not verified, it shows the "verification email sent" message with a "resend email button"
- Implements the route `/account/verify?email=${email}&code=xxxxxxx`
- Performs an automatic verification attempt using a `useEffect`
- If success redirect to `/organization`
- Else show an error
- **Resend verification mail mutation is implemented but won't work until implemented on the backend**

In addition, it implements specific considerations for dev environments: 

- On signin page it shows a button to redirect to verify page without having verification code (because is not needed)
- It permits empty verification codes on verify page (on dev envs they are not neeeded)

An it fixes API function to:

- throw plain text errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants