CloudClub-uoft / cloud-club-website

Club Website
https://cloudclub.ca
4 stars 4 forks source link

Reset Password Feature #86

Closed Lepabryce closed 2 years ago

Lepabryce commented 2 years ago

Ensure to create the required password_reset table:

CREATE TABLE `password_reset` (
  `request_id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL,
  `request_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `token` text NOT NULL,
  PRIMARY KEY (`request_id`)
);
harsimrat99 commented 2 years ago

Hi Bryce,

Thank you for taking the time to contribute this feature to the website. As an additional request, it will be helpful if you could please create frontend and backend testcase for this feature.

Guidance for frontend testcases :

Selenium test case for the main password reset user stories: "As a user, I want to send a password reset email to my account."

Link to Selenium Read

Guidance for backend testcase:

A mocha/chai testcase to test that the token is saved inside the database table and that an email is successfully sent. (I am currently researching how to mock sessions and looking at how to perform "integration" tests. It is not convenient to unit test an entire route because it is composed of multiple individual units. In this case, an integration test may be a more accurate term to describe our motive: to ensure that when a user clicks on a pwd. rst. button, the database is populated with a rst. token)

harsimrat99 commented 2 years ago

Additionally, we were discussing about version controlling our database. If you have some time, could you please look at PR #87?

I am going to add some instructions there to explain how to create a migration for specific table in the database.

Thank you, Harsimrat

Lepabryce commented 2 years ago

Added unit tests and integrated with DB migrations (PR #87)

Lepabryce commented 2 years ago

Hi @harsimrat99, I implemented the env variables in the code and reduced the token to 64 characters in the latest commit. Let me know if there are any other issues.

Thanks, Bryce