diff options
author | azul <azul@riseup.net> | 2013-09-24 01:37:57 -0700 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-09-24 01:37:57 -0700 |
commit | 98db0cc42019dfcd90d58e0126fe691590fde2e2 (patch) | |
tree | c8a3bf7fe4c8001718ea31e56d036b267ee362e6 /users/app/models/email.rb | |
parent | c081062ea16526dfbf3ad9ba0fdec724be67949c (diff) | |
parent | a9c68ba0bbba7a95e9b4a3ff24554d1b0af6cbc5 (diff) |
Merge pull request #88 from jessib/feature/only_lower_case_aliases
Feature/only lower case aliases
Diffstat (limited to 'users/app/models/email.rb')
-rw-r--r-- | users/app/models/email.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/users/app/models/email.rb b/users/app/models/email.rb index 1bcff1c..f38f2f5 100644 --- a/users/app/models/email.rb +++ b/users/app/models/email.rb @@ -3,10 +3,16 @@ class Email < String validates :email, :format => { - :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, + :with => /\A([^@\s]+)@((?:[-a-zA-Z0-9]+\.)+[a-zA-Z]{2,})\Z/, #checks format, but allows lowercase :message => "needs to be a valid email address" } + validates :email, + :format => { + :with => /\A[^A-Z]*\Z/, #forbids uppercase characters + :message => "letters must be lowercase" + } + def to_partial_path "emails/email" end @@ -19,4 +25,8 @@ class Email < String self end + def handle + self.split('@').first + end + end |