CSC/ECE 517 Fall 2022 - E2252. Refactor auth controller.rb & password retrieval controller.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 4: Line 4:
TODO: Describe the objectives of the project and what issues we were attempting to address.
TODO: Describe the objectives of the project and what issues we were attempting to address.
== Files Modified ==
== Files Modified ==
Changes to <code>password_retrieval_controller.rb</code>:
Changes to <code>app/controllers/password_retrieval_controller.rb</code>:
{| class="wikitable"
{| class="wikitable" style="width: 100%;
! &nbsp;#&nbsp; !! Change !! Rationale !! Commit Link
! &nbsp;#&nbsp; !! Change !! Rationale !! Commit Link
|-
|-
Line 24: Line 24:
|-
|-
|4
|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]
Line 32: Line 32:
|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.
|[https://github.com/expertiza/expertiza/commit/1af745dc3b59641cb0266ebe49ee996718381fd0 Commit]
|[https://github.com/expertiza/expertiza/commit/1af745dc3b59641cb0266ebe49ee996718381fd0 Commit]
|}
Changes to <code>config/routes.rb</code>:
{| class="wikitable" style="width: 100%;
! &nbsp;#&nbsp; !! Change !! Rationale !! Commit Link
|-
|1
|Updated URL path and controller action to updated method name <code>check_token_validity</code>
|The action and URL path must be renamed to generate pathing to the controller method and views.
|[https://github.com/expertiza/expertiza/commit/3f9f63ab51e90743dfab0b860574aa9b673f2717 Commit]
|-
|}
|}



Revision as of 19:38, 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 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