greenlight icon indicating copy to clipboard operation
greenlight copied to clipboard

Verify account 5 : Resend verification UI & API integration.

Open KH-Amir-TN opened this issue 2 years ago • 5 comments

Description

Enable users to activate their accounts.

This PR completes 5.

~~0. Add active boolean attribute, default to false; activation_digest unique string; activation_sent_at datetime to the users model.~~ ~~1. Add verify_account_controller#create that:~~ ~~- Creates a UNIQUE activation token.~~ ~~- saves its digest and sent time to the selected user.~~ ~~- Send the token to the selected user email [Saved for upcoming sprints].~~

~~2. Extend/Update users_controller#create to trigger the verify_account_controller#create logic for the created user account.~~ ~~3. Extend/Update users_controller#update to deactivate the user account if their email changes.~~ ~~4. Add verify_account_controller#activate that:~~ ~~- Validates the given token.~~ ~~- activate its associated account [if valid].~~ ~~- Invalidate the used/expired token.~~ ~~5. Add resend verification UI page and hook the resend to verify_account_controller#create API.~~ 6. Hook the UI app to verify_account_controller#activate API.

User story [Account activation]:


  1. User creates an account.
  2. User receives an email with a link to activate their account.

[If the link isn't used]: 3. User sign-in. 3. User will have a UI that displayes a descriptive message indicating that they have to validate their accounts. 4. User click the resend button to receive a new activation link. NOTE: User will be able to only update their profile, sign-in, sign-out, resend activation link until they activate their account.

[If the link is clicked while it's valid]:

  1. User will have an adequate feedback from the app.
  2. User will be redirected to sign-in [if not authenticated] or to rooms space [if authenticated].

[If the link is invalid]:

  1. User will have an adequate feedback from the app.
  2. User will be redirected to homepage.

Testing Steps

  1. Pull the code.
  2. Install the dependencies bundle install && npm|yarn install.
  3. Clean the previous assets build by running rm app/assets/builds/* (This won't remove .keep since it's hidden).
  4. Clean the database and tmp files for a better isolation by running rails tmp:clear && rails db:schema:cache:clear && rails db:drop && rails db:create && rails db:migrate:with_data
  5. Run the linter and specs bundle exec rubocop --parallel && bundle exec rspec && npx eslint app/javascript/* --ext .jsx,.js
  6. Run ./bin/dev to run the assets builders processes and the Puma server all at once.

Screenshots (if appropriate):

image image

KH-Amir-TN avatar Jun 20 '22 18:06 KH-Amir-TN

~~DEPENDS ON #3556~~

KH-Amir-TN avatar Jun 20 '22 18:06 KH-Amir-TN

REBASED ON afc5e89406e1dc5c529f254cf7de602fa67014b5

KH-Amir-TN avatar Jun 29 '22 13:06 KH-Amir-TN

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarqubecloud[bot] avatar Jun 29 '22 13:06 sonarqubecloud[bot]

This PR is making multiple changes - some of which need to be discussed.

Authorization needs to be applied to the app as a whole in its own PR and not as part of another PR

farhatahmad avatar Jun 29 '22 14:06 farhatahmad

This PR is making multiple changes - some of which need to be discussed.

Authorization needs to be applied to the app as a whole in its own PR and not as part of another PR

I agree, lets put it on hold

KH-Amir-TN avatar Jun 29 '22 15:06 KH-Amir-TN