wristband 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.1.0
@@ -11,15 +11,15 @@ module Wristband
11
11
  end
12
12
 
13
13
  module InstanceMethods
14
- def login(session_user)
15
- login_as_user(session_user.user, session_user.remember_me)
14
+ def login(session_user, cookie_expires_at = 2.weeks.from_now.utc)
15
+ login_as_user(session_user.user, session_user.remember_me, cookie_expires_at)
16
16
  end
17
17
 
18
- def login_as_user(user, remember_me=false)
18
+ def login_as_user(user, remember_me=false, cookie_expires_at = 2.weeks.from_now.utc)
19
19
  self.current_user = user
20
20
  if remember_me
21
21
  token = Support.encrypt_with_salt(user.id.to_s, Time.now.to_f.to_s)
22
- cookies[:login_token] = { :value => token, :expires => 2.weeks.from_now.utc }
22
+ cookies[:login_token] = { :value => token, :expires => cookie_expires_at}
23
23
  user.update_attribute(:remember_token, token)
24
24
  end
25
25
  end
@@ -13,12 +13,12 @@ module Wristband
13
13
  def encrypt_with_salt(password, salt)
14
14
  return password unless (salt and !salt.empty?)
15
15
 
16
- Digest::SHA1.hexdigest([ password, salt ].to_s)
16
+ Digest::SHA1.hexdigest([ password, salt ].join)
17
17
  end
18
18
  module_function :encrypt_with_salt
19
19
 
20
20
  def random_salt(length = nil)
21
- salt = Digest::SHA1.hexdigest([ rand, rand, random_string(64), rand, rand ].to_s)
21
+ salt = Digest::SHA1.hexdigest([ rand, rand, random_string(64), rand, rand ].join)
22
22
 
23
23
  length ? salt[0, length] : salt
24
24
  end
@@ -90,4 +90,5 @@ class SessionsControllerTest < ActionController::TestCase
90
90
  assert_not_nil assigns(:session_user).user.remember_token
91
91
  assert_equal assigns(:session_user).user.remember_token, cookies['login_token']
92
92
  end
93
+
93
94
  end
data/wristband.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wristband}
8
- s.version = "1.0.5"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jack Neto", "The Working Group Inc"]
12
- s.date = %q{2011-06-27}
12
+ s.date = %q{2011-09-13}
13
13
  s.description = %q{Provides a starting point for user authentication}
14
14
  s.email = %q{jack@theworkinggroup.ca}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wristband
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,12 +10,12 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-06-27 00:00:00.000000000 -04:00
13
+ date: 2011-09-13 00:00:00.000000000 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
18
- requirement: &2169497820 !ruby/object:Gem::Requirement
18
+ requirement: &2168802080 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 3.0.4
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2169497820
26
+ version_requirements: *2168802080
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: haml
29
- requirement: &2169497240 !ruby/object:Gem::Requirement
29
+ requirement: &2168801260 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 3.0.25
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2169497240
37
+ version_requirements: *2168801260
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: formatted_form
40
- requirement: &2169496660 !ruby/object:Gem::Requirement
40
+ requirement: &2168800540 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *2169496660
48
+ version_requirements: *2168800540
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: sqlite3
51
- requirement: &2169496120 !ruby/object:Gem::Requirement
51
+ requirement: &2168799800 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *2169496120
59
+ version_requirements: *2168799800
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: jeweler
62
- requirement: &2169495540 !ruby/object:Gem::Requirement
62
+ requirement: &2168799280 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *2169495540
70
+ version_requirements: *2168799280
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rails
73
- requirement: &2169494940 !ruby/object:Gem::Requirement
73
+ requirement: &2168798720 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: 3.0.4
79
79
  type: :runtime
80
80
  prerelease: false
81
- version_requirements: *2169494940
81
+ version_requirements: *2168798720
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: haml
84
- requirement: &2169494360 !ruby/object:Gem::Requirement
84
+ requirement: &2168798060 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: 3.0.25
90
90
  type: :runtime
91
91
  prerelease: false
92
- version_requirements: *2169494360
92
+ version_requirements: *2168798060
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: formatted_form
95
- requirement: &2169493780 !ruby/object:Gem::Requirement
95
+ requirement: &2168797340 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,7 +100,7 @@ dependencies:
100
100
  version: 1.0.0
101
101
  type: :runtime
102
102
  prerelease: false
103
- version_requirements: *2169493780
103
+ version_requirements: *2168797340
104
104
  description: Provides a starting point for user authentication
105
105
  email: jack@theworkinggroup.ca
106
106
  executables: []
@@ -177,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  segments:
179
179
  - 0
180
- hash: -2039141860052392450
180
+ hash: 2843623027733758625
181
181
  required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements: