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

#167749954 Implement Password Reset Feature #24

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

daviddamilola
Copy link
Collaborator

What does this PR do?

Add password reset feature

Description of Task to be completed?

  • add test for password reset endpoint
  • add password reset endpoint routes.
  • add update Password service.
  • add verify email and send email Helper.
  • add password validation user schema.
  • update documentation.

How should this be manually tested?

  • git clone the branch
  • set the environment variables
  • run postman
  • send a POST request to /api/v1/users/reset
  • send a PATCH request containing the new password to the link in the email

Any background context you want to provide?

nodemailer was used to send the email.

What are the relevant pivotal tracker stories?

#167749954

.travis.yml Outdated
@@ -9,6 +9,11 @@ before_script:
node_js:
- 'stable'

env:
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can remove the environment variables, it has been added on Travis

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changes have been implemented.

src/config/swagger.json Outdated Show resolved Hide resolved
"firstname": {
"type": "string"
},
"lastname": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"lastname": {
"lastName": {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changes have been implemented

Responses.setError(400, 'this address link has expired')
return Responses.send(res);
}
if (req.method == 'GET') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (req.method == 'GET') {
if (req.method === 'GET') {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changes have been implemented

@@ -19,4 +20,4 @@ export default (sequelize, DataTypes) => {
},
}, {});
return User;
};
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can always add newlines at the end of a file

Copy link
Collaborator

@Naimaoye Naimaoye left a comment

Choose a reason for hiding this comment

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

Good job David. I think you need to add new lines at the end of some of your files, please check through

Copy link
Collaborator

@hustlaviola hustlaviola left a comment

Choose a reason for hiding this comment

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

A lot of files does not have newlines at the end. Consider adding them. You can also rebase off ft-JWT-auth-167749949 to implement some changes on your branch. This is good work, well done.

@daviddamilola daviddamilola changed the title #167749954 Add Password Reset Feature #167749954 Implement Password Reset Feature Sep 9, 2019
@@ -0,0 +1,11 @@
import express from 'express';
Copy link
Collaborator

Choose a reason for hiding this comment

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

This file has been deleted. Consider rebasing

@@ -18,13 +18,13 @@ describe('Handle requests on other endpoints', () => {
});
});

it('should return an error when a wrong url is provided', done => {
it('should return a welcome message for version 1 of the API', done => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test has been removed as well

* @memberof Helper
*/
static async verifyExistingEmail(email) {
const check = await models.User.findOne({ where: { email , isVerified: true} });
Copy link

Choose a reason for hiding this comment

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

A space is required before '}' object-curly-spacing
There should be no space before ',' comma-spacing

@daviddamilola daviddamilola force-pushed the ft-password-reset-167749954 branch 5 times, most recently from 841e522 to c984a91 Compare September 12, 2019 17:11
})
.end((err, res) => {
console.log(res.body);
Copy link

Choose a reason for hiding this comment

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

Unexpected console statement no-console

@@ -2,6 +2,7 @@ import RequestService from '../services/RequestService';
import Responses from '../utils/Responses';
import Helper from '../utils/Helper';

console.log(Helper.hashPassword('Frank1234'));
Copy link

Choose a reason for hiding this comment

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

Unexpected console statement no-console

@daviddamilola daviddamilola force-pushed the ft-password-reset-167749954 branch 3 times, most recently from a373c32 to 88bb648 Compare September 12, 2019 18:29
}
],
"responses": {
"201": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can change the status code here

Suggested change
"201": {
"200": {

id, email, createdAt, updatedAt
} = rowsAffected;
Responses.setSuccess(
201,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
201,
200,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the feedback @hustlaviola , changes have been implemented.

@daviddamilola daviddamilola force-pushed the ft-password-reset-167749954 branch 5 times, most recently from a6dc289 to 4ca4635 Compare September 14, 2019 11:49
@daviddamilola daviddamilola force-pushed the ft-password-reset-167749954 branch 3 times, most recently from 4fede16 to a94b80c Compare September 16, 2019 12:24
return Responses.send(res);
}
}
}
Copy link

Choose a reason for hiding this comment

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

Newline required at end of file but not found eol-last

@daviddamilola daviddamilola force-pushed the ft-password-reset-167749954 branch 3 times, most recently from bf512a0 to c85c118 Compare September 17, 2019 06:17
 - add test for password reset endpoint
 - add password reset endpoint routes.
 - add update Password service.
 - add verify email and send email Helper.
 - add password validation userSchema.
 - update documentation.

[Delivers #167749954]
@daviddamilola daviddamilola merged commit e7f3c42 into develop Sep 20, 2022
@ldonjibson
Copy link
Collaborator

you still dey work on the stuff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants