Skip to content

E2604. Finish Password Resets#302

Open
johnmweisz wants to merge 81 commits into
expertiza:mainfrom
johnmweisz:development
Open

E2604. Finish Password Resets#302
johnmweisz wants to merge 81 commits into
expertiza:mainfrom
johnmweisz:development

Conversation

@johnmweisz
Copy link
Copy Markdown

@johnmweisz johnmweisz commented Mar 20, 2026

This implements the backend portion of password reset functionality.

Frontend PR is here: expertiza/reimplementation-front-end#153

Feature detail can be reviewed here: https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2026_-_E2604._Finish_Password_Resets

Issue: #264

Notes

jshah23 and others added 30 commits March 24, 2025 00:05
…smpt pass in development.rb and configuring the mailer
# Conflicts:
#	README.md
#	app/controllers/passwords_controller.rb
#	app/models/user.rb
#	config/routes.rb
- Using I18n locales for text that would be displayed to the user
  - this allows us a central location to have messages while giving the possibility of adding more languages in the future
- moved the user out of factories.rb and into factories/user.rb to centralize the user factory
- added a password_reset_user factory that extends the user factory to be able to test password resets
- updating the passwords controller and user_mailer to use the I18n text

## passwords_controller_spec.rb
- had to fix the controller being referenced (API::V1) No longer exists
- changed user to the password_reset_user
- had to remove tests that are no longer valid
- updated the reset email check to verify the token is sent
- updated the invalid user response to match the new response
- When testing updating the password, added in a token for testing
- added in a check to ensure the password updated properly
…igurable

#7 make baseurl configurable, align email and template
The unit tests weren't working, so made updates to get them working
Need time_helpers to be included for travel_to to work for testing expired tokens.
needed to add time_helpers to th rails_helper
- The user tests had tests no longer valid for the password reset.
  - Removed 3 tests from the user_spec.rb file

## User mailer
- split out the token url to a helper method for better testing
- wrote an rspec test to cover the user_mailer
…tests

Cleaning up user tests and adding mailer tests
JaredM2028 and others added 26 commits March 29, 2026 13:12
Tests updated to be more robust for token searching. Tests to come.
- updated .gitignore to not capture .env and .env.* files
- added FRONTEND_(SCHEME|DOMAIN|PORT) to sample.env with descriptions about each
- updated the README.md file to include environment setup since this configuration will be important going forward
- updated the user_mailer.rb to use the new FRONTEND_URL constant from environment.rb

## environment.rb
- we add the frontend configuration to the environment.rb file
- defaults are read from each environment config, but can be overridden by the .env file
- If the FRONTEND_DOMAIN isn't set, then we raise a configuration error
- dev/test set the frontend port to 3000 by default
- if the scheme has a standard port we don't add it to the url, but if it isn't a standard port and isn't nil then we append it to the frontend url
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Making sure that the FRONTEND_URL is included in the email body
ensuring that we test the frontend url and link to contain the frontend url and reset token
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
with rails using config.x.<variable> is preferred for custom settings
…nfig

Making FRONTEND_URL use environment settings as requested
in the readme the section regarding setting env variable ended up with missing data
This was caused from a batch suggestion apply of copilot in GitHub
@johnmweisz johnmweisz closed this Apr 12, 2026
@johnmweisz johnmweisz deleted the development branch April 12, 2026 19:35
@johnmweisz johnmweisz restored the development branch April 13, 2026 13:17
@johnmweisz johnmweisz reopened this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants