diff options
author | Azul <azul@leap.se> | 2012-10-07 21:00:48 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-10-07 21:00:48 +0200 |
commit | 44c06bea22d2824037a7bd3b08ddf0a4c7c9116b (patch) | |
tree | 97e020e66546a1d79f93986ef5bb9dfad4f9aea3 /users/app/models | |
parent | 6ae43acde6cd43c6383cd47e00f978ed339ea991 (diff) | |
parent | d776e9ea988b0bc00b24c0e0760bcfe3d95057a7 (diff) |
Merge branch 'release-0.1.0' into deploy
Diffstat (limited to 'users/app/models')
-rw-r--r-- | users/app/models/user.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb index a6aab84..1afb9db 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -5,8 +5,19 @@ class User < CouchRest::Model::Base property :password_verifier, String, :accessible => true property :password_salt, String, :accessible => true - validates :login, :password_salt, :password_verifier, :presence => true - validates :login, :uniqueness => true + validates :login, :password_salt, :password_verifier, + :presence => true + + validates :login, + :uniqueness => true + + validates :login, + :format => { :with => /\A[A-Za-z\d_]+\z/, + :message => "Only letters, digits and _ allowed" } + + validates :password_salt, :password_verifier, + :format => { :with => /\A[\dA-Fa-f]+\z/, + :message => "Only hex numbers allowed" } timestamps! @@ -22,8 +33,8 @@ class User < CouchRest::Model::Base # valid set of attributes for testing def valid_attributes_hash { :login => "me", - :password_verifier => "1234", - :password_salt => "4321" } + :password_verifier => "1234ABC", + :password_salt => "4321AB" } end end |