Skip to content

Force email addresses to be lower case #4880

Open
@carlobeltrame

Description

@carlobeltrame

This issue needs to be re-specified, it's not ready for implementation right now.

We currently allow to store email addresses containing capital letters. This leads to some minor bugs, e.g. it is possible to invite the same email address multiple times with different capitalization: [email protected] is treated as different from [email protected]. This circumvents our unique index on the inviteEmail column of CampCollaboration.

For modifying the input which users submit in various input fields, we have input filters. One example is InputFilter\Trim, which is used to trim whitespace from the start and end of input fields.

To fix the mixed-case email addresses, we should:

  • Create a new input filter InputFilter\Lowercase, along with the InputFilter\LowercaseFilter class which actually performs the modification
  • Add the #[InputFilter\Lowercase] annotation to Profile#email and Profile#newEmail
  • Add the #[InputFilter\Lowercase] annotation to CampCollaboration#inviteEmail
  • Add the #[InputFilter\Lowercase] annotation to ResetPassword#email
  • Add unit tests for the InputFilter\LowercaseFilter, similar to the tests for the trim filter
  • Add API tests for all API operations which use the modified fields (create and update on these three entities), similar to the already existing trim tests
  • After the oauth flow we need to lowercase the email too, + search for the existing email with the lowercase email from the oauth flow
  • Optional: Write a data migration to convert all existing data in the database to lower case. ⚠️ If there are already duplicate emails, we need a conflict resolution.

Maybe possible alternative:

  • Use a collation for this field which ignores the case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Design

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions