diff options
author | jessib <jessib@riseup.net> | 2013-09-23 12:23:08 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-09-23 12:23:08 -0700 |
commit | a9c68ba0bbba7a95e9b4a3ff24554d1b0af6cbc5 (patch) | |
tree | c8a3bf7fe4c8001718ea31e56d036b267ee362e6 /users/app/models/identity.rb | |
parent | 906e177b35606835c4f10a9de65d9bd83cbe21ad (diff) |
This ensures that email addresses contain only lowercase letters, and that an identity's destination is a valid Email.
Diffstat (limited to 'users/app/models/identity.rb')
-rw-r--r-- | users/app/models/identity.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/users/app/models/identity.rb b/users/app/models/identity.rb index 91345a0..e0a24e9 100644 --- a/users/app/models/identity.rb +++ b/users/app/models/identity.rb @@ -12,6 +12,7 @@ class Identity < CouchRest::Model::Base validate :unique_forward validate :alias_available validate :address_local_email + validate :destination_email design do view :by_user_id @@ -91,4 +92,9 @@ class Identity < CouchRest::Model::Base self.errors.add(:address, address.errors.messages[:email].first) #assumes only one error end + def destination_email + return if destination.valid? #this ensures it is Email + self.errors.add(:destination, destination.errors.messages[:email].first) #assumes only one error #TODO + end + end |