mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Validate user email syntax on change
We probably have invalid entries in the database and we don't want these records to suddenly become invalid. People would not be able to log in.
This commit is contained in:
@@ -48,6 +48,7 @@ module Spree
|
||||
|
||||
after_create :associate_customers, :associate_orders
|
||||
|
||||
validates :email, 'valid_email_2/email': true, if: :email_changed?
|
||||
validate :limit_owned_enterprises
|
||||
validates :uid, uniqueness: true, if: lambda { uid.present? }
|
||||
validates_email :uid, if: lambda { uid.present? }
|
||||
|
||||
@@ -92,7 +92,7 @@ describe Spree::User do
|
||||
expect(user.errors.messages[:email]).to include "is invalid"
|
||||
end
|
||||
|
||||
pending "detects backslashes at the end" do
|
||||
it "detects backslashes at the end" do
|
||||
user.email = "example@gmail.com\\\\"
|
||||
expect(user).to_not be_valid
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user