diff options
author | Azul <azul@leap.se> | 2012-11-13 12:00:13 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-11-13 12:00:13 +0100 |
commit | 6ba3366f778340ebeaa73fd53372368b16de6c98 (patch) | |
tree | 8249f6cd14e1ba859fd63a35f9f24456cb307d13 /users/app/models | |
parent | 78475cb1b3d4f18a5c0a0fb326e6465b92a5f0e7 (diff) |
using client side validations during signup
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 |