wristband 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/wristband/user_extensions.rb +21 -2
- data/lib/wristband.rb +4 -2
- data/test/unit/wristband_test.rb +2 -0
- data/wristband.gemspec +3 -4
- metadata +75 -113
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
@@ -59,8 +59,28 @@ module Wristband
|
|
59
59
|
self.send("#{self.class.wristband[:password_column]}=", Wristband::Support.encrypt_with_salt(self.password, self.password_salt))
|
60
60
|
end
|
61
61
|
|
62
|
+
# 231badb19b93e44f47da1bd64a8147f2
|
62
63
|
def password_match?(string)
|
63
|
-
|
64
|
+
if matches_legacy_password?(string)
|
65
|
+
self.password = string
|
66
|
+
initialize_salt
|
67
|
+
encrypt_password
|
68
|
+
self.send("#{self.class.wristband[:legacy_password][:column_name]}=", nil)
|
69
|
+
self.save
|
70
|
+
else
|
71
|
+
self.send(self.class.wristband[:password_column]) == Wristband::Support.encrypt_with_salt(string, self.password_salt)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def matches_legacy_password?(string)
|
76
|
+
return unless self.class.wristband[:legacy_password][:column_name].present? && self.send(self.class.wristband[:legacy_password][:column_name]).present?
|
77
|
+
|
78
|
+
case self.class.wristband[:legacy_password][:encryption]
|
79
|
+
when :md5
|
80
|
+
self.send("#{self.class.wristband[:legacy_password][:column_name]}") == Digest::MD5.hexdigest(string)
|
81
|
+
else
|
82
|
+
false
|
83
|
+
end
|
64
84
|
end
|
65
85
|
|
66
86
|
def password_hash=(value)
|
@@ -73,7 +93,6 @@ module Wristband
|
|
73
93
|
def reset_perishable_token!
|
74
94
|
update_attribute(:perishable_token, Wristband::Support.random_salt.gsub(/[^A-Za-z0-9]/,''))
|
75
95
|
end
|
76
|
-
|
77
96
|
end
|
78
97
|
end
|
79
98
|
end
|
data/lib/wristband.rb
CHANGED
@@ -5,7 +5,7 @@ require 'wristband/authority_check'
|
|
5
5
|
|
6
6
|
module Wristband
|
7
7
|
|
8
|
-
VERSION = "1.0.
|
8
|
+
VERSION = "1.0.5"
|
9
9
|
|
10
10
|
class Engine < ::Rails::Engine; end
|
11
11
|
|
@@ -22,6 +22,7 @@ module Wristband
|
|
22
22
|
options[:after_authentication] ||= []
|
23
23
|
options[:has_authorities] ||= false
|
24
24
|
options[:roles] ||= []
|
25
|
+
options[:legacy_password] ||= {}
|
25
26
|
|
26
27
|
class_eval do
|
27
28
|
include Wristband::UserExtensions
|
@@ -53,7 +54,8 @@ module Wristband
|
|
53
54
|
:before_authentication_chain => [options[:before_authentication]].flatten,
|
54
55
|
:after_authentication_chain => [options[:after_authentication]].flatten,
|
55
56
|
:password_column => options[:password_column],
|
56
|
-
:roles => options[:roles]
|
57
|
+
:roles => options[:roles],
|
58
|
+
:legacy_password => options[:legacy_password]
|
57
59
|
}
|
58
60
|
|
59
61
|
if options[:has_authorities]
|
data/test/unit/wristband_test.rb
CHANGED
@@ -11,6 +11,7 @@ class WristbandTest < ActiveSupport::TestCase
|
|
11
11
|
initialize_token
|
12
12
|
encrypt_password
|
13
13
|
password_match?
|
14
|
+
matches_legacy_password?
|
14
15
|
password_hash=
|
15
16
|
is_admin?
|
16
17
|
is_regular_user?
|
@@ -46,6 +47,7 @@ class WristbandTest < ActiveSupport::TestCase
|
|
46
47
|
assert_equal User.wristband[:after_authentication_chain], []
|
47
48
|
assert_equal User.wristband[:password_column], :password_hash
|
48
49
|
assert_equal User.wristband[:roles], ['admin', 'regular_user']
|
50
|
+
assert_equal User.wristband[:legacy_password], {}
|
49
51
|
end
|
50
52
|
|
51
53
|
def test_authentication_by_email
|
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.
|
8
|
+
s.version = "1.0.5"
|
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-
|
12
|
+
s.date = %q{2011-06-27}
|
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 = [
|
@@ -73,7 +73,7 @@ Gem::Specification.new do |s|
|
|
73
73
|
]
|
74
74
|
s.homepage = %q{http://github.com/twg/wristband}
|
75
75
|
s.require_paths = ["lib"]
|
76
|
-
s.rubygems_version = %q{1.
|
76
|
+
s.rubygems_version = %q{1.6.2}
|
77
77
|
s.summary = %q{An authentication engine}
|
78
78
|
s.test_files = [
|
79
79
|
"test/dummy/user.rb",
|
@@ -88,7 +88,6 @@ Gem::Specification.new do |s|
|
|
88
88
|
]
|
89
89
|
|
90
90
|
if s.respond_to? :specification_version then
|
91
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
92
91
|
s.specification_version = 3
|
93
92
|
|
94
93
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,146 +1,113 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wristband
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 1.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.5
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Jack Neto
|
13
9
|
- The Working Group Inc
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-02-15 00:00:00 -05:00
|
13
|
+
date: 2011-06-27 00:00:00.000000000 -04:00
|
19
14
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
22
17
|
name: rails
|
23
|
-
requirement: &
|
18
|
+
requirement: &2169497820 !ruby/object:Gem::Requirement
|
24
19
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 3
|
30
|
-
- 0
|
31
|
-
- 4
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
32
23
|
version: 3.0.4
|
33
24
|
type: :runtime
|
34
25
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
version_requirements: *2169497820
|
27
|
+
- !ruby/object:Gem::Dependency
|
37
28
|
name: haml
|
38
|
-
requirement: &
|
29
|
+
requirement: &2169497240 !ruby/object:Gem::Requirement
|
39
30
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 3
|
45
|
-
- 0
|
46
|
-
- 25
|
31
|
+
requirements:
|
32
|
+
- - ! '>='
|
33
|
+
- !ruby/object:Gem::Version
|
47
34
|
version: 3.0.25
|
48
35
|
type: :runtime
|
49
36
|
prerelease: false
|
50
|
-
version_requirements: *
|
51
|
-
- !ruby/object:Gem::Dependency
|
37
|
+
version_requirements: *2169497240
|
38
|
+
- !ruby/object:Gem::Dependency
|
52
39
|
name: formatted_form
|
53
|
-
requirement: &
|
40
|
+
requirement: &2169496660 !ruby/object:Gem::Requirement
|
54
41
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
- 0
|
60
|
-
version: "0"
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
61
46
|
type: :runtime
|
62
47
|
prerelease: false
|
63
|
-
version_requirements: *
|
64
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *2169496660
|
49
|
+
- !ruby/object:Gem::Dependency
|
65
50
|
name: sqlite3
|
66
|
-
requirement: &
|
51
|
+
requirement: &2169496120 !ruby/object:Gem::Requirement
|
67
52
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
- 0
|
73
|
-
version: "0"
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
74
57
|
type: :development
|
75
58
|
prerelease: false
|
76
|
-
version_requirements: *
|
77
|
-
- !ruby/object:Gem::Dependency
|
59
|
+
version_requirements: *2169496120
|
60
|
+
- !ruby/object:Gem::Dependency
|
78
61
|
name: jeweler
|
79
|
-
requirement: &
|
62
|
+
requirement: &2169495540 !ruby/object:Gem::Requirement
|
80
63
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
- 0
|
86
|
-
version: "0"
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
87
68
|
type: :development
|
88
69
|
prerelease: false
|
89
|
-
version_requirements: *
|
90
|
-
- !ruby/object:Gem::Dependency
|
70
|
+
version_requirements: *2169495540
|
71
|
+
- !ruby/object:Gem::Dependency
|
91
72
|
name: rails
|
92
|
-
requirement: &
|
73
|
+
requirement: &2169494940 !ruby/object:Gem::Requirement
|
93
74
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
segments:
|
98
|
-
- 3
|
99
|
-
- 0
|
100
|
-
- 4
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
101
78
|
version: 3.0.4
|
102
79
|
type: :runtime
|
103
80
|
prerelease: false
|
104
|
-
version_requirements: *
|
105
|
-
- !ruby/object:Gem::Dependency
|
81
|
+
version_requirements: *2169494940
|
82
|
+
- !ruby/object:Gem::Dependency
|
106
83
|
name: haml
|
107
|
-
requirement: &
|
84
|
+
requirement: &2169494360 !ruby/object:Gem::Requirement
|
108
85
|
none: false
|
109
|
-
requirements:
|
110
|
-
- -
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
segments:
|
113
|
-
- 3
|
114
|
-
- 0
|
115
|
-
- 25
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
116
89
|
version: 3.0.25
|
117
90
|
type: :runtime
|
118
91
|
prerelease: false
|
119
|
-
version_requirements: *
|
120
|
-
- !ruby/object:Gem::Dependency
|
92
|
+
version_requirements: *2169494360
|
93
|
+
- !ruby/object:Gem::Dependency
|
121
94
|
name: formatted_form
|
122
|
-
requirement: &
|
95
|
+
requirement: &2169493780 !ruby/object:Gem::Requirement
|
123
96
|
none: false
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
segments:
|
128
|
-
- 1
|
129
|
-
- 0
|
130
|
-
- 0
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
131
100
|
version: 1.0.0
|
132
101
|
type: :runtime
|
133
102
|
prerelease: false
|
134
|
-
version_requirements: *
|
103
|
+
version_requirements: *2169493780
|
135
104
|
description: Provides a starting point for user authentication
|
136
105
|
email: jack@theworkinggroup.ca
|
137
106
|
executables: []
|
138
|
-
|
139
107
|
extensions: []
|
140
|
-
|
141
|
-
extra_rdoc_files:
|
108
|
+
extra_rdoc_files:
|
142
109
|
- README.md
|
143
|
-
files:
|
110
|
+
files:
|
144
111
|
- .DS_Store
|
145
112
|
- Gemfile
|
146
113
|
- Gemfile.lock
|
@@ -198,37 +165,32 @@ files:
|
|
198
165
|
has_rdoc: true
|
199
166
|
homepage: http://github.com/twg/wristband
|
200
167
|
licenses: []
|
201
|
-
|
202
168
|
post_install_message:
|
203
169
|
rdoc_options: []
|
204
|
-
|
205
|
-
require_paths:
|
170
|
+
require_paths:
|
206
171
|
- lib
|
207
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
208
173
|
none: false
|
209
|
-
requirements:
|
210
|
-
- -
|
211
|
-
- !ruby/object:Gem::Version
|
212
|
-
|
213
|
-
segments:
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
segments:
|
214
179
|
- 0
|
215
|
-
|
216
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
hash: -2039141860052392450
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
182
|
none: false
|
218
|
-
requirements:
|
219
|
-
- -
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
|
222
|
-
- 0
|
223
|
-
version: "0"
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
224
187
|
requirements: []
|
225
|
-
|
226
188
|
rubyforge_project:
|
227
|
-
rubygems_version: 1.
|
189
|
+
rubygems_version: 1.6.2
|
228
190
|
signing_key:
|
229
191
|
specification_version: 3
|
230
192
|
summary: An authentication engine
|
231
|
-
test_files:
|
193
|
+
test_files:
|
232
194
|
- test/dummy/user.rb
|
233
195
|
- test/functional/passwords_controller_test.rb
|
234
196
|
- test/functional/sessions_controller_test.rb
|