From 6ba3366f778340ebeaa73fd53372368b16de6c98 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 13 Nov 2012 12:00:13 +0100 Subject: using client side validations during signup --- users/app/models/user.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'users/app/models') 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 -- cgit v1.2.3