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/login_format_validation.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/login_format_validation.rb')
-rw-r--r-- | users/app/models/login_format_validation.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/users/app/models/login_format_validation.rb b/users/app/models/login_format_validation.rb index 1d02bd1..c1fcf70 100644 --- a/users/app/models/login_format_validation.rb +++ b/users/app/models/login_format_validation.rb @@ -1,19 +1,21 @@ module LoginFormatValidation extend ActiveSupport::Concern + #TODO: Probably will replace this. Playing with using it for aliases too, but won't want it connected to login field. + included do # Have multiple regular expression validations so we can get specific error messages: validates :login, :format => { :with => /\A.{2,}\z/, - :message => "Login must have at least two characters"} + :message => "Must have at least two characters"} validates :login, :format => { :with => /\A[a-z\d_\.-]+\z/, :message => "Only lowercase letters, digits, . - and _ allowed."} validates :login, :format => { :with => /\A[a-z].*\z/, - :message => "Login must begin with a lowercase letter"} + :message => "Must begin with a lowercase letter"} validates :login, :format => { :with => /\A.*[a-z\d]\z/, - :message => "Login must end with a letter or digit"} + :message => "Must end with a letter or digit"} end end |