diff options
Diffstat (limited to 'users/app/models')
-rw-r--r-- | users/app/models/user.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 0f5d650..824c439 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -16,8 +16,11 @@ class User < CouchRest::Model::Base :message => "Only letters, digits and _ allowed" } validates :password_salt, :password_verifier, - :format => { :with => /\A[\dA-Fa-f]+\z/, - :message => "Only hex numbers allowed" } + :format => { :with => /\A[\dA-Fa-f]+\z/, :message => "Only hex numbers allowed" } + + validates :password, :presence => true, + :confirmation => true, + :format => { :with => /.{8}.*/, :message => "needs to be at least 8 characters long" } timestamps! @@ -71,4 +74,8 @@ class User < CouchRest::Model::Base APP_CONFIG['admins'].include? self.login end + protected + def password + password_verifier + end end |