summaryrefslogtreecommitdiff
path: root/users/app/models/user.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-11-13 12:00:13 +0100
committerAzul <azul@leap.se>2012-11-13 12:00:13 +0100
commit6ba3366f778340ebeaa73fd53372368b16de6c98 (patch)
tree8249f6cd14e1ba859fd63a35f9f24456cb307d13 /users/app/models/user.rb
parent78475cb1b3d4f18a5c0a0fb326e6465b92a5f0e7 (diff)
using client side validations during signup
Diffstat (limited to 'users/app/models/user.rb')
-rw-r--r--users/app/models/user.rb11
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