summaryrefslogtreecommitdiff
path: root/users/app/models
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-10-11 12:53:10 +0200
committerAzul <azul@leap.se>2012-10-11 12:53:10 +0200
commit09003d3d2df7c250d3a0b55e83094e5e27094859 (patch)
tree90d2a851cd558652121182937a5ec8373722cab0 /users/app/models
parent118d9ab5c9f4d7a82b7cf24774ef12d3c221f8ef (diff)
parent33ef3d2ac9a03b06ff29f1367c69731a89f1dfc7 (diff)
Merge branch 'release-0.1.0' into develop
Diffstat (limited to 'users/app/models')
-rw-r--r--users/app/models/user.rb19
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