uber_login 1.0.0 → 1.0.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
- NjcyNWVjZmViMmQ3ZTY4MDljODFjYjAxZDc2YmY5YmE4ZDEyNjhiZA==
4
+ YjcyNWJjYjgwNTZlYTM0OTBiNjk4Y2YyNTQ2YmY1ODRkYmE4MmIxOQ==
5
5
  data.tar.gz: !binary |-
6
- ZDg0ZTA4MzZkODQ4ZThjN2FkOTYyNjllMTk5MDY1ZmUxZDdlN2NmYg==
6
+ OTJmNGMwMzQyOTMxNWE4YjlkYmY2MDYzMzc3YjQwNTMzNjVmOWM3Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWFjODkyYjYwN2FlNDFkY2I0NTUwZDZlMmIyMGJhMzRiNTg5MGM1YmY0YzVj
10
- M2Y0YTBhY2U0NjNkNThiMDg4MDJlYjM4NjAwNWUxNzcxYTc0N2E1MjdmZDZh
11
- NmQzYWNkN2Q0YzhhODNlYmQ2ZmNmYTNmMzZjZGRlMzdhNmNkMTE=
9
+ ZjM3OTE0Y2VkZjg2MmU3ODcxMjM1MDU5N2M1OGE1YzNiNjhhMzRhMjE1ZDA3
10
+ Yzc2ZjUwMTc1ZGJlMWRiOGY2NzYzYzgzZmJhYWNkNmM5NDM3NjY3ZDExZjYw
11
+ MTI2OTc3ZjVmNDg0MTVhNDViODRlOTQ1NDk0MjY3MDk4ZjE5ODA=
12
12
  data.tar.gz: !binary |-
13
- MTJmMWI1MDhjODQzMWZlNWEzYjk2YzQxMTYxYzc3MGEzNWMyNDM5ZWU2MTc1
14
- NDM0ZjQ2OGVhMjgxMzlkN2QyZGJlNThhODNiMDNmOWFjYTI1ZWU5MjVmMWVk
15
- ZjlmOWI5N2JjMGJmYmY0MjdmNGNiODkzZjc0YWZkMzg2OGZiZTU=
13
+ MTBhOTUxMDBkZmE1YjMxMmQ3NTdmNjhhMWYxOGFjZjk3MjE2ZTkxYjM2ZTk5
14
+ MzQ1MjMzYWIwYzBlYzQyYzAwNDhhMTlkODYwNTVjM2U4OTkxY2YyZjFiNWQy
15
+ OThkYzJjZDg4OGVmYzViZTYzYzUzNWYwODgxNTBjNWYyZDllYmE=
@@ -15,8 +15,8 @@ module UberLogin
15
15
  ##
16
16
  # Sets the +:uid+ and +:ulogin+ cookies for next login
17
17
  def persistent_login(uid, composite)
18
- @cookies.permanent[:uid] = uid
19
- @cookies.permanent[:ulogin] = TokenEncoder.encode_array composite
18
+ set_cookie(:uid, uid)
19
+ set_cookie(:ulogin, TokenEncoder.encode_array(composite))
20
20
  end
21
21
 
22
22
  ##
@@ -40,5 +40,10 @@ module UberLogin
40
40
  def login_cookies?
41
41
  @cookies[:uid] and @cookies[:ulogin]
42
42
  end
43
+
44
+ private
45
+ def set_cookie(key, value)
46
+ @cookies.permanent[key] = { value: value, httponly: true, secure: @request.ssl? }
47
+ end
43
48
  end
44
49
  end
@@ -1,3 +1,3 @@
1
1
  module UberLogin
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,14 @@ class FakeCookieJar < Hash
6
6
  def permanent
7
7
  self
8
8
  end
9
+
10
+ def []=(key, val)
11
+ if val.class == Hash
12
+ super(key, val[:value])
13
+ else
14
+ super(key, val)
15
+ end
16
+ end
9
17
  end
10
18
 
11
19
  class FakeRequest
@@ -16,6 +24,10 @@ class FakeRequest
16
24
  def user_agent
17
25
  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"
18
26
  end
27
+
28
+ def ssl?
29
+ true
30
+ end
19
31
  end
20
32
 
21
33
  class ApplicationController
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: 1.0.0
4
+ version: 1.0.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: 2013-12-17 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: useragent
@@ -24,7 +24,8 @@ dependencies:
24
24
  - - ! '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.10.0
27
- description: Login and logout management with secure "remember me" capabilities
27
+ description: Login and logout management with secure "remember me" capabilities and
28
+ complete session control. You can even force a user to logout!
28
29
  email: fra.boffa@gmail.com
29
30
  executables: []
30
31
  extensions: []