diff options
author | Azul <azul@leap.se> | 2012-10-07 20:09:00 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-10-07 20:09:00 +0200 |
commit | 2215250a39162f9e1fcb8f90e02a637faa63438c (patch) | |
tree | b9ab1fd90e508de0d876b5abcf1acca9d5efeaf6 /users | |
parent | 4abbb521c0a23f90a7790db20b281df3f062f4f9 (diff) |
added validations
Diffstat (limited to 'users')
-rw-r--r-- | users/app/models/user.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb index a6aab84..e10f55e 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -5,8 +5,17 @@ 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, + :format => { :with => /\A\w+\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! |