CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb & password retrieval controller.rb
Overview of Expertiza
TODO: Add description of general expertiza system and how our controllers relate to the overall functionality.
Description of Project
TODO: Describe the objectives of the project and what issues we were attempting to address.
Files Modified
Changes to app/controllers/password_retrieval_controller.rb
:
# | Change | Rationale | Commit Link |
---|---|---|---|
1 | Updated check_reset_url method name to check_token_validity
|
The method validates that the password reset token is valid and present. The updated method name provides a more functionally descriptive name. | Commit |
2 | Replaced repeated code in lines 35-36 and 62-63 | The use of repeated code violates the DRY principle and so it was moved to a new method. | Commit |
3 | Change token expiration time to constant in line 41 | This time should not be hardwired; it should be a constant or a parameter. | Commit |
4 | Reload page if email is nil or empty on password_retrieval/forgotten view
|
An empty email parameter was causing the send password button to freeze. | Commit |
5 | Improve overall comments and rewrite error messages | The comments and error messages in the controller need to be more meaningful, specific and clear. | Commit |
Changes to config/routes.rb
:
# | Change | Rationale | Commit Link |
---|---|---|---|
1 | Updated URL path and controller action to updated method name check_token_validity
|
The action and URL path must be renamed to generate pathing to the controller method and views. | Commit |
Testing
TODO: Show how the existing testing suite was passing before and after our refactoring - preserving functionality.
Relevant Links
- Github Repository: https://github.com/greyfiles/expertiza
- Pull Request: https://github.com/expertiza/expertiza/pull/2460