greenlight
greenlight copied to clipboard
Verify account 5 : Resend verification UI & API integration.
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]:
- User creates an account.
- 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]:
- User will have an adequate feedback from the app.
- User will be redirected to sign-in [if not authenticated] or to rooms space [if authenticated].
[If the link is invalid]:
- User will have an adequate feedback from the app.
- User will be redirected to homepage.
Testing Steps
- Pull the code.
- Install the dependencies
bundle install && npm|yarn install
.- Clean the previous assets build by running
rm app/assets/builds/*
(This won't remove .keep since it's hidden).- 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
- Run the linter and specs
bundle exec rubocop --parallel && bundle exec rspec && npx eslint app/javascript/* --ext .jsx,.js
- Run
./bin/dev
to run the assets builders processes and the Puma server all at once.
Screenshots (if appropriate):
~~DEPENDS ON #3556~~
REBASED ON afc5e89406e1dc5c529f254cf7de602fa67014b5
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
1 Code Smell
No Coverage information
0.0% Duplication
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
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