authentasaurus 0.6.17 → 0.6.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,9 +18,9 @@ module ActiveRecord::ActsAsAuthenticatable
18
18
  end
19
19
 
20
20
 
21
- ## Authenticates the username and password
22
- def authenticate(username, password, remember = false)
23
- user=self.find_by_username username
21
+ ## Authenticates the username (or email) and password
22
+ def authenticate(username_or_email, password, remember = false)
23
+ user=self.find_by_username(username_or_email) || self.find_by_email(username_or_email)
24
24
  if user
25
25
  expected_password=encrypt_password(password, user.password_seed)
26
26
  unless expected_password == user.hashed_password && user.active
@@ -7,9 +7,9 @@ module ActiveRecord::ActsAsAuthenticatableValidatable
7
7
  end
8
8
 
9
9
  module ClassMethods
10
- ## Authenticates the username and password
11
- def authenticate(username, password, remember = false)
12
- user=self.find_by_username username
10
+ ## Authenticates the username (or email) and password
11
+ def authenticate(username_or_email, password, remember = false)
12
+ user=self.find_by_username(username_or_email) || self.find_by_email(username_or_email)
13
13
  if user
14
14
  expected_password=encrypt_password(password, user.password_seed)
15
15
  unless expected_password == user.hashed_password && user.active && user.validation.nil?
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: 37
4
+ hash: 35
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 17
10
- version: 0.6.17
9
+ - 18
10
+ version: 0.6.18
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-09-20 00:00:00 +03:00
21
+ date: 2010-09-28 00:00:00 +03:00
22
22
  default_executable:
23
23
  dependencies: []
24
24