uber_login 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGRhZTQ5MjJjMDllYzc1NWIyZGVlZDA5MzczZmMwYjA2YjJkMGZhNw==
4
+ ZTkxZWIxMGZiMzM0MTVjMzE2YTFkODEyMTk5NTQ4MWVhMTg0ZmU4MA==
5
5
  data.tar.gz: !binary |-
6
- MTdjMjU4OTM5ZGM2ZWE0NGFiZjcwZTU1ZGY0MGFjYzYzMGUxZDM4OA==
6
+ NTRiY2EwNjc3Njk0MDBlYjQ2YWYwZjkzNmUwZDU2MjRhNDM3OGQ0ZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmUxY2NmOWZkMTYwNDAxZjYyMzEwMTkxMzgwZmQ2MGZlMzNjZTNlMDhhYzJh
10
- MDE0NTAzMjlkZGE5MjIwMzdjODJlMGRlMGQxNGYzN2Y2Yjk1NWY4ZjY0YTcw
11
- ODNjZmVjYzVkNDAxMGE3ZDE0YWRlZGJlMDcyYWI5ZjU4MWU3M2M=
9
+ NWFlODA0OThhOGIxYzgzNGY0MWI5OTM4Njc0ZmE1OTgzMzA0MjVlNzFlMzEw
10
+ ODZhMDJhZTVmMzMzYTdkN2I0ODYxNzc2NDhjYTcwYTc1NTEwOTc0YjZjNDEw
11
+ MmU5YjNhZjllN2VlY2MxODljMzk0MWFjNTE4YjczNzE1ZGFiZDc=
12
12
  data.tar.gz: !binary |-
13
- YjU3MjE4MzkzNGI0NmM3N2FlNjcwN2QxNTJjYmJhODQ2NGQwMDgyN2ExMWEy
14
- YTI1NWNmNjljYjNiM2QxYTBlMDk4NmRmZjJkZTZhZTUzZmRjZWY2MjM2OWQ3
15
- NDJjNWY4YmZkYzM1MTI2ZWZlYjhkMTQ0MjdjMmQwODBkNDA0YWE=
13
+ ZGMyOGJjYzVhYmQ4YzlmMzFhOGU1YWJhN2Y0MTZjYzZhMjFlNGM0OWFiMTgx
14
+ NjVkNzZmODUzODEzNDM3OWU1NTFhZWFmZmU0NmUwMWMwNmVjNDIzYTU5ZjZm
15
+ MDdlMTI1YWM1N2Q4ZDVmNzQyYTMxYmM5ODczZGJiOWYxZjg5ZjU=
@@ -2,7 +2,7 @@ module UberLogin
2
2
  class Storage
3
3
  class << self
4
4
  def find(uid, sequence)
5
- LoginToken.find_by(uid: uid, sequence: sequence)
5
+ LoginToken.where(uid: uid, sequence: sequence).first
6
6
  end
7
7
 
8
8
  def find_composite(uid, composite)
@@ -1,3 +1,3 @@
1
1
  module UberLogin
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
data/lib/uber_login.rb CHANGED
@@ -43,17 +43,18 @@ module UberLogin
43
43
  def login(user, remember = false)
44
44
  logout_all unless UberLogin.configuration.allow_multiple_login
45
45
  @login_from_cookies = false
46
+ uid = get_uid(user)
46
47
 
47
48
  run_callbacks :login do
48
49
  if strong_sessions or remember
49
- composite = generate_and_save_token(user.id)
50
- cookie_manager.persistent_login(user.id, composite) if remember
50
+ composite = generate_and_save_token(uid)
51
+ cookie_manager.persistent_login(uid, composite) if remember
51
52
  else
52
53
  composite = nil
53
54
  end
54
55
 
55
56
  reset_session
56
- session_manager.login(user.id, composite)
57
+ session_manager.login(uid, composite)
57
58
  end
58
59
  end
59
60
 
@@ -194,6 +195,11 @@ module UberLogin
194
195
  UberLogin.configuration.strong_sessions
195
196
  end
196
197
 
198
+ def get_uid(user)
199
+ uid = user.id
200
+ uid = uid.to_s if uid.is_a? BSON::ObjectId
201
+ end
202
+
197
203
  def current_sequence
198
204
  TokenEncoder.sequence(cookies[:ulogin] || session[:ulogin])
199
205
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uber_login
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Boffa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-02 00:00:00.000000000 Z
11
+ date: 2014-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: useragent