authentasaurus 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,6 +51,11 @@ module ActiveRecord::ActsAsAuthenticatable
51
51
  end
52
52
 
53
53
  module InstanceMethods
54
+ def username=(username)
55
+ return if username.blank?
56
+ self.username = username.downcase
57
+ end
58
+
54
59
  ## Password attribute (used when creating a user)
55
60
  def password
56
61
  return @password
@@ -14,6 +14,7 @@ module ActiveRecord::Authenticatable
14
14
  # basic attributes
15
15
  validates_presence_of :username, :hashed_password, :password_seed, :email, :name
16
16
  validates_uniqueness_of :username, :email
17
+ validates_format_of :username, :with => /^[a-z0-9^ ]*([a-z0-9]{4})+[a-z0-9^ ]*$/ # alpha-numeric only and at least 4 characters
17
18
  validates_format_of :email, :with => %r{[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}}
18
19
  # password validations
19
20
  validates_confirmation_of :password, :on => :create
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentasaurus
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 6
10
- version: 0.6.6
9
+ - 7
10
+ version: 0.6.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Omar Mekky
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-08-16 00:00:00 +02:00
21
+ date: 2010-08-18 00:00:00 +02:00
22
22
  default_executable:
23
23
  dependencies: []
24
24