summaryrefslogtreecommitdiff
path: root/users/app
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-09-05 13:56:02 -0700
committerjessib <jessib@riseup.net>2013-09-05 13:56:02 -0700
commit8e8f5ddda08a883842a8c3e2ffa994e12b25dd39 (patch)
tree2521633ca0bc090e76147db004aac2bfd343e225 /users/app
parent59adb0892f443e1fe1bdd4201c4e0db1b036e0af (diff)
Ensure that address in identity really is a LocalEmail.
Diffstat (limited to 'users/app')
-rw-r--r--users/app/models/identity.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/users/app/models/identity.rb b/users/app/models/identity.rb
index 355f67a..e197c9c 100644
--- a/users/app/models/identity.rb
+++ b/users/app/models/identity.rb
@@ -10,6 +10,7 @@ class Identity < CouchRest::Model::Base
validate :unique_forward
validate :alias_available
+ validate :address_local_email
design do
view :by_user_id
@@ -79,4 +80,9 @@ class Identity < CouchRest::Model::Base
end
end
+ def address_local_email
+ return if address.valid? #this ensures it is LocalEmail
+ self.errors.add(:address, address.errors.messages[:email].first) #assumes only one error
+ end
+
end