summaryrefslogtreecommitdiff
path: root/users/app/models
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-10-07 21:00:36 +0200
committerAzul <azul@leap.se>2012-10-07 21:00:36 +0200
commitd776e9ea988b0bc00b24c0e0760bcfe3d95057a7 (patch)
treed99ff7d801a6f280bd637e0681ef05e67db57d48 /users/app/models
parent2215250a39162f9e1fcb8f90e02a637faa63438c (diff)
adding validations for valid login chars and verifier and salt being hex
Diffstat (limited to 'users/app/models')
-rw-r--r--users/app/models/user.rb10
1 files changed, 6 insertions, 4 deletions
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