diff options
author | Azul <azul@leap.se> | 2013-08-21 09:49:26 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-08-21 09:49:26 +0200 |
commit | 75db45671d432a0d81805ad50c6cc9f8f7eff7a7 (patch) | |
tree | 48504f5dc9dae4953aab37b8a142dccd8b895020 /users/app/models/session.rb | |
parent | 115d96398246dcda23a51728dfafe1ea3c8ede88 (diff) |
use the same login validations on sessions and users
The session ones were outdated so valid usernames could not login if they contained a '.'
Refactored so both models use the same module for this validation to ensure consistency.
Diffstat (limited to 'users/app/models/session.rb')
-rw-r--r-- | users/app/models/session.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/users/app/models/session.rb b/users/app/models/session.rb index a9fdb1b..0d7e10e 100644 --- a/users/app/models/session.rb +++ b/users/app/models/session.rb @@ -1,12 +1,10 @@ class Session < SRP::Session include ActiveModel::Validations + include LoginFormatValidation attr_accessor :login - validates :login, - :presence => true, - :format => { :with => /\A[A-Za-z\d_]+\z/, - :message => "Only letters, digits and _ allowed" } + validates :login, :presence => true def initialize(user = nil, aa = nil) super(user, aa) if user |