From d776e9ea988b0bc00b24c0e0760bcfe3d95057a7 Mon Sep 17 00:00:00 2001 From: Azul Date: Sun, 7 Oct 2012 21:00:36 +0200 Subject: adding validations for valid login chars and verifier and salt being hex --- users/app/models/user.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'users/app/models/user.rb') diff --git a/users/app/models/user.rb b/users/app/models/user.rb index e10f55e..1afb9db 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -9,8 +9,10 @@ class User < CouchRest::Model::Base :presence => true validates :login, - :uniqueness => true, - :format => { :with => /\A\w+\z/, + :uniqueness => true + + validates :login, + :format => { :with => /\A[A-Za-z\d_]+\z/, :message => "Only letters, digits and _ allowed" } validates :password_salt, :password_verifier, @@ -31,8 +33,8 @@ class User < CouchRest::Model::Base # valid set of attributes for testing def valid_attributes_hash { :login => "me", - :password_verifier => "1234", - :password_salt => "4321" } + :password_verifier => "1234ABC", + :password_salt => "4321AB" } end end -- cgit v1.2.3