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

Update guest invite and guest confirmation flows #639

Merged
merged 19 commits into from
Jan 31, 2024
Merged

Conversation

erikguntner
Copy link
Collaborator

Closes #405
Close #440

What changes did you make?

The following changes allow coordinators to invite guests to HUU by filling out a short form and sending an invitation link to the provided email. The guest can then accept the invite by clicking the provided link and confirm their account by creating a new password. This PR builds off the work that was done in #558 by handling some edge cases and writing tests. The changes include:

  • Adding a separate endpoint to handle accepting invites. The original flow had users receiving a temporary password they would use to sign in before being prompted to create a new one. This meant the /auth/signin endpoint handled signing in normally, as well as signing in with a temporary password. In an effort to streamline the process and simplify logic, I used a lambda function to add a link to the email and create a separate endpoint that handles signing in with the temporary password. If the user accepts the invite successfully, they are redirected to the new password page, and a userId and sessionId are included in the URL params. These two params then get passed along when creating their new password in order to complete the flow. If unsuccessful, an error message is included in the URL params and displayed to the user.
  • Adding a success message after a guest is successfully invited.
  • Adding alerts for errors and loading states on buttons.
  • Some small refactors to make sure the existing services were hitting the right endpoints and sending the correct data

Rationale behind the changes?

After merging #558 I noticed there was still work needed in order to get the invite guest and guest confirmation user flows working properly. These changes allow both flows to be completed.

Testing done for these changes

  • I wrote unit tests for the guest invite button component
  • I wrote Cypress tests for the new password page to confirm the userId, sessionId, and error params were successfully being accessed from the URL and that the user's session starts after creating a new password.

Screenshots of Proposed Changes Of The Website (if any, please do not screen shot code changes)

Visuals before changes are applied

image

Visuals after changes are applied
Screen.Recording.2023-11-14.at.6.44.14.PM.mov
Screenshot 2023-11-14 at 6 44 55 PM
Screen.Recording.2023-11-14.at.6.45.10.PM.mov

@erikguntner erikguntner changed the title Update guest invite Update guest invite and guest confirmation flows Nov 16, 2023
@JpadillaCoding
Copy link
Member

Hey Erik, was there a way you could test the signup feature from the email on local?

@erikguntner
Copy link
Collaborator Author

@JpadillaCoding Are you trying to test out the flow on your machine? I think the only way you could test the sign up locally would be by sending an invite to an email you have access to.

@JpadillaCoding
Copy link
Member

JpadillaCoding commented Jan 14, 2024

Gotcha, so while trying to test it out I get an error CustomMessage failed with error Cannot read properties of undefined (reading 'url').
I was wondering if this was maybe because it is being tested locally or not. Are you getting the same message?
Also note that attempting to send it again after that error results in the error an account with the given email already exists. So it seems that It is going through on our end but not actually sending.
This does also bring up a question: Do we want to make it so the invite can be sent an indefinite amount of times in the case of the email being deleted or not being received? Currently it seems that the only way to get another email sent is if the user is deleted from the database.
Apart from that the modal works great being responsive and all the buttons work as intended.

@erikguntner
Copy link
Collaborator Author

erikguntner commented Jan 17, 2024

@JpadillaCoding I just went through the sign up using an email flow and invite guest flow on my computer with no issues.

so while trying to test it out I get an error CustomMessage failed with error Cannot read properties of undefined (reading 'url')

This error may be because you are not passing a url in the request. This could be an issue with the .env not having a proper url, but I'm not sure. Happy to debug this during the meeting

Also note that attempting to send it again after that error results in the error an account with the given email already exists.

There is a way to resend an invite to an existing user by passing MessageAction='RESEND', to the boto3 client this just hasn't been implemented yet. I can't remember exactly what we decided as far as how we want to handle resends. I'll look through some of the issues and bring it up to PM if I can't find anything.

Copy link
Member

@JpadillaCoding JpadillaCoding left a comment

Choose a reason for hiding this comment

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

After testing the feature everything works as expected. A user can invite a guest, the guest can accept the invitation and create a new password, the new account is added to the DB and the account is active.
No suggestions as far as the code, everything looks good!

@erikguntner erikguntner merged commit 182c537 into main Jan 31, 2024
4 checks passed
@erikguntner erikguntner deleted the update-guest-invite branch January 31, 2024 02:17
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.

Section 1 | SubFlow 1c: Guest Account Confirmation Section 1 | Subflow 1b: Coordinator Invite Guests
2 participants