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

#167730744 Implements Reset password feature #25

Merged
merged 90 commits into from
Sep 6, 2019

Conversation

conquext
Copy link
Collaborator

@conquext conquext commented Aug 22, 2019

What does this PR do?

  • Resets user password by sending a cryptographically stamped token to the email of a registered user on request. The token allows a user to set new password. Only a valid user can reset passwords, invalid requests are sent links to sign up on the website

Description of Task to be completed?

  • None

How should this be manually tested?

  • git clone this repo https://github.com/andela/firestar-backend.git

  • cd to firestar-backend

  • git checkout ft-reset-password-167730744

  • run npm install

  • set PORT on .env to 4000

  • set TOKENEXPIRY to any integer value (describes the expiration time for your reset password link in seconds)

  • CLIENT_URL links to an heroku url where the api is served or any local server

  • DB_USERNAME=
    *DB_PASSWORD=
    *DB_NAME=
    *DB_TEST_NAME=
    *NODE_ENV=test
    and

Register for an account on sendgrid.com and create API key at https://app.sendgrid.com/settings/api_keys, then set the following environment variables

  • SENDGRID_API_KEY

Also in your .env, supply this field with valid information to receive reset link in your email
YOUR_EMAIL="" (description: Creates a user account with this email to receive reset password link)
SOME_PASSWORD="" (description: Create user account with password, Must include more than 3 characters)

  • DO ONLY npm test (to run tests)

OR

  • npm run migrate:dev (to create necessary database tables)
  • npm run seed:dev (to populate a test database )
  • run npm start:dev (to start development server)

Then startup POSTMAN and

  • go to localhost:4000/api/v1/users/passwords/forgot (HTTP METHOD: POST) and supply one of the emails you sync with (in your YOUR_EMAIL env)
  • then you should get an email with a rest link
  • then copy the link in your email into postman, set {password and confirmPassword}
  • also try invalid data to catch errors

To test resetpassword

  • From the link in your email, copy the link to postman and run a POST request

Any background context you want to provide?

  • Users may be lose access to their account, but are able to retrieve it with their email. Emails provide proof of authentication and obfuscate the membership of the network to only the members.

What are the relevant pivotal tracker stories?

Screenshots or gifs (Code coverage)

image

image

image

Questions:

  • N/A

@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 August 22, 2019 00:30 Inactive
src/validation/password.js Outdated Show resolved Hide resolved
src/validation/password.js Outdated Show resolved Hide resolved
src/validation/password.js Outdated Show resolved Hide resolved
src/validation/password.js Outdated Show resolved Hide resolved
src/validation/password.js Outdated Show resolved Hide resolved
src/validation/isEmpty.js Outdated Show resolved Hide resolved
src/validation/index.js Outdated Show resolved Hide resolved
src/validation/index.js Outdated Show resolved Hide resolved
src/validation/index.js Outdated Show resolved Hide resolved
src/validation/index.js Outdated Show resolved Hide resolved
@conquext conquext added the peer Review This PR is up for team members reviews label Aug 22, 2019
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 August 22, 2019 01:00 Inactive
src/validation/isValidEmail.js Outdated Show resolved Hide resolved
src/validation/email.js Outdated Show resolved Hide resolved
src/validation/email.js Outdated Show resolved Hide resolved
src/validation/email.js Outdated Show resolved Hide resolved
src/validation/email.js Outdated Show resolved Hide resolved
src/utils/response.js Outdated Show resolved Hide resolved
src/utils/hash/index.js Outdated Show resolved Hide resolved
src/utils/hash/index.js Outdated Show resolved Hide resolved
src/utils/hash/hash.js Outdated Show resolved Hide resolved
src/utils/hash/hash.js Outdated Show resolved Hide resolved
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 August 22, 2019 01:09 Inactive
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 06:22 Inactive
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 07:29 Inactive
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 09:27 Inactive
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 09:35 Inactive
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 10:05 Inactive
@conquext conquext added work in progress This PR is still a work in progress. do not merge! and removed ready for merge This PR is ready for TTL review and merging labels Sep 5, 2019
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 10:51 Inactive
@conquext conquext added ready for merge This PR is ready for TTL review and merging and removed work in progress This PR is still a work in progress. do not merge! labels Sep 5, 2019
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 11:37 Inactive
package.json Outdated Show resolved Hide resolved
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 16:15 Inactive
@rovilay rovilay temporarily deployed to firestar-backend-staging-pr-25 September 5, 2019 21:51 Inactive
Copy link
Contributor

@rovilay rovilay left a comment

Choose a reason for hiding this comment

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

Could be a lot better.

@rovilay rovilay merged commit 2dabcbf into stage Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for merge This PR is ready for TTL review and merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants