diff --git a/app/controllers/auth/passwords_controller.rb b/app/controllers/auth/passwords_controller.rb index c76ebaf6a..a990325f9 100644 --- a/app/controllers/auth/passwords_controller.rb +++ b/app/controllers/auth/passwords_controller.rb @@ -4,7 +4,7 @@ class Auth::PasswordsController < Devise::PasswordsController def reset_confirmation self.resource = resource_class.new @email = params["email"] - if @email.empty? + if @email.blank? resource.errors.add :email, I18n.t("validations.email.blank") render "devise/passwords/new", status: :unprocessable_entity elsif !email_valid?(@email) diff --git a/spec/requests/auth/passwords_controller_spec.rb b/spec/requests/auth/passwords_controller_spec.rb index 70357062e..29a032395 100644 --- a/spec/requests/auth/passwords_controller_spec.rb +++ b/spec/requests/auth/passwords_controller_spec.rb @@ -145,4 +145,12 @@ RSpec.describe Auth::PasswordsController, type: :request do end end end + + context "when a password is reset" do + let(:email) { nil } + + it "does not error if the email is nil or not in the params" do + expect { get account_password_reset_confirmation_path(email:) }.not_to raise_error + end + end end