navapbc / template-application-rails

Ruby on Rails with USWDS template, including CI/CD, for teams building web applications
Apache License 2.0
1 stars 0 forks source link

Forgot Password with nonexistent email #42

Closed SammySteiner closed 4 weeks ago

SammySteiner commented 4 weeks ago

What happened?

When entering an email that is not in the database into the forgot password form, the application errors out: image

Steps to reproduce

  1. click on Or sign into an existing account from either employers or employees from the home page
  2. click on Forgot your password?
  3. enter a valid email that isn't attributed to a user, like: asdfasdf@adsf.asdf
  4. This triggers the error in the screenshot above

What browsers are you seeing the problem on?

Chrome

Relevant log output

app-rails-1  | 13:42:46 web.1  | Started POST "/users/forgot-password" for 192.168.65.1 at 2024-06-27 13:42:46 +0000
app-rails-1  | 13:42:46 web.1  | Processing by Users::PasswordsController#send_reset_password_instructions as TURBO_STREAM
app-rails-1  | 13:42:46 web.1  |   Parameters: {"authenticity_token"=>"[FILTERED]", "users_forgot_password_form"=>"[FILTERED]", "commit"=>"Send code", "locale"=>"en"}
app-rails-1  | 13:42:46 web.1  | Completed 500 Internal Server Error in 7ms (ActiveRecord: 0.0ms | Allocations: 1894)
app-rails-1  | 13:42:46 web.1  | 
app-rails-1  | 13:42:46 web.1  | 
app-rails-1  | 13:42:46 web.1  |   
app-rails-1  | 13:42:46 web.1  | TypeError (no implicit conversion of nil into String):
app-rails-1  | 13:42:46 web.1  |   
app-rails-1  | 13:42:46 web.1  | app/adapters/auth/cognito_adapter.rb:268:in `+'
app-rails-1  | 13:42:46 web.1  | app/adapters/auth/cognito_adapter.rb:268:in `get_secret_hash'
app-rails-1  | 13:42:46 web.1  | app/adapters/auth/cognito_adapter.rb:51:in `forgot_password'
app-rails-1  | 13:42:46 web.1  | app/services/auth_service.rb:10:in `forgot_password'
app-rails-1  | 13:42:46 web.1  | app/controllers/users/passwords_controller.rb:20:in `send_reset_password_instructions'
app-rails-1  | 13:42:46 web.1  | app/controllers/application_controller.rb:14:in `switch_locale'
SammySteiner commented 4 weeks ago

My bad, the env variables changed and I didn't read the error closely enough.