CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb & password retrieval controller.rb: Difference between revisions
Jump to navigation
Jump to search
Line 6: | Line 6: | ||
Changes to <code>password_retrieval_controller.rb</code>: | Changes to <code>password_retrieval_controller.rb</code>: | ||
{| class="wikitable" | {| class="wikitable" | ||
! Change !! Rationale !! Commit Link | ! # !! Change !! Rationale !! Commit Link | ||
|- | |- | ||
|1 | |||
|Updated <code>check_reset_url</code> method name to <code>check_token_validity</code> | |Updated <code>check_reset_url</code> method name to <code>check_token_validity</code> | ||
|The method validates that the password reset token is valid and present. The updated method name provides a more functionally descriptive name. | |The method validates that the password reset token is valid and present. The updated method name provides a more functionally descriptive name. | ||
|[https://github.com/expertiza/expertiza/commit/3f9f63ab51e90743dfab0b860574aa9b673f2717 Commit] | |[https://github.com/expertiza/expertiza/commit/3f9f63ab51e90743dfab0b860574aa9b673f2717 Commit] | ||
|- | |- | ||
|2 | |||
|Replaced repeated code in lines 35-36 and 62-63 | |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. | |The use of repeated code violates the DRY principle and so it was moved to a new method. | ||
|[https://github.com/expertiza/expertiza/commit/5429abd6fcb39f7bdbb0aaa1813f19c8101d7e25 Commit] | |[https://github.com/expertiza/expertiza/commit/5429abd6fcb39f7bdbb0aaa1813f19c8101d7e25 Commit] | ||
|- | |- | ||
|3 | |||
|Change token expiration time to constant in line 41 | |Change token expiration time to constant in line 41 | ||
|This time should not be hardwired; it should be a constant or a parameter. | |This time should not be hardwired; it should be a constant or a parameter. | ||
|[https://github.com/expertiza/expertiza/commit/3f0b51f6f2f106df8338483396a95d4068e39c7f Commit] | |[https://github.com/expertiza/expertiza/commit/3f0b51f6f2f106df8338483396a95d4068e39c7f Commit] | ||
|- | |- | ||
|4 | |||
|Reload page if email is nil or empty on <code>password_retrieval/forgotten<code> view | |Reload page if email is nil or empty on <code>password_retrieval/forgotten<code> view | ||
|An empty email parameter was causing the send password button to freeze. | |An empty email parameter was causing the send password button to freeze. | ||
|[https://github.com/expertiza/expertiza/commit/70f77ac851b234f840709859dc1ee9d6725c34fc Commit] | |[https://github.com/expertiza/expertiza/commit/70f77ac851b234f840709859dc1ee9d6725c34fc Commit] | ||
|- | |- | ||
|5 | |||
|Improve overall comments and rewrite error messages | |Improve overall comments and rewrite error messages | ||
|The comments and error messages in the controller need to be more meaningful, specific and clear. | |The comments and error messages in the controller need to be more meaningful, specific and clear. |
Revision as of 19:22, 25 October 2022
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 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 |
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 |
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