summaryrefslogtreecommitdiff
path: root/users/app/models/user.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2012-10-08 11:05:17 -0700
committerjessib <jessib@riseup.net>2012-10-08 11:05:17 -0700
commit8f100d3c03a6f554e703c5d0b2fe221958424c26 (patch)
tree77e90f53d05fecefa91adf89a3c35f19e277996b /users/app/models/user.rb
parentf77301824c42bdd4559a0b0e58b8f3c26f239643 (diff)
parentf5aea5347601c3500bb3670971d44995c35c3c7b (diff)
Merge branch 'release-0.1.0' into help_develop
Conflicts: .gitignore
Diffstat (limited to 'users/app/models/user.rb')
-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 33c77ce..8b7c0b3 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