diff options
author | Azul <azul@leap.se> | 2012-11-18 09:15:03 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-11-18 09:15:03 +0100 |
commit | 66e5f9d639a34df1912f7562223fa65d29183d96 (patch) | |
tree | 8249f6cd14e1ba859fd63a35f9f24456cb307d13 /users/app/models/user.rb | |
parent | b9fb554ca4cb45233bd1323047b357f649bd495b (diff) | |
parent | 6ba3366f778340ebeaa73fd53372368b16de6c98 (diff) |
Merge branch 'feature-client-side-validations' into develop
Diffstat (limited to 'users/app/models/user.rb')
-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 |