Skip to content

Comments

Fix: Trim whitespace from email before processing#6731

Open
stella-entry wants to merge 1 commit intorubyforgood:mainfrom
stella-entry:fix/strip-email-whitespace
Open

Fix: Trim whitespace from email before processing#6731
stella-entry wants to merge 1 commit intorubyforgood:mainfrom
stella-entry:fix/strip-email-whitespace

Conversation

@stella-entry
Copy link

Resolves #6689

Summary

  • Added &.strip to email parameter in update_user_email method to remove leading/trailing whitespace
  • Added test case to verify whitespace is stripped from email input

Problem

When users accidentally include leading or trailing spaces in their email address while updating their profile, the system would attempt to process the email with whitespace intact, resulting in errors.

Solution

Strip whitespace from the email parameter before processing, similar to standard email input sanitization practices.

Testing

  • Added new test case strips whitespace from email in spec/requests/users_spec.rb
  • All existing tests continue to pass

How to Test

  1. Sign in as a volunteer
  2. Go to profile edit page
  3. Enter email with leading/trailing spaces: test@example.com
  4. Submit the form
  5. Email should be saved as test@example.com (without spaces)

Resolves rubyforgood#6689

- Added .strip to email parameter in update_user_email method
- Added test to verify whitespace is stripped from email input
- This prevents errors when users accidentally include leading/trailing spaces
@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 labels Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Pull requests that update Ruby code Tests! 🎉💖👏

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trim whitespace before processing new email value in backend

1 participant