openproject-token 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/open_project/token/version.rb +1 -1
- data/lib/open_project/token.rb +12 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f959bb6247948bcf6fd18e7f09c798e5b037d1a4d62bf6e1c92781e7e2e5e4e6
|
4
|
+
data.tar.gz: 9d42841010ef13874b4a3b489c1e96bb750c0650e00a94ed583008623279fbfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9128f8b0bc9d6cb550dc89c1d085bed523f552f53c44800b3f51819e2b386fe77d2734178bf9c66de8bbd8506de0ee21b32fe7af3362f8bc6916a93eea7ffee
|
7
|
+
data.tar.gz: 3e3172042fac599e58fb80aaa569adfa697a30713eab643d5f4a085728a725d2e7e8b8561772a778266ee8bb5d3211bb6a46bce80d3987cec1fbc6bdc04d971d
|
data/lib/open_project/token.rb
CHANGED
@@ -134,8 +134,8 @@ module OpenProject
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def valid_domain?(input)
|
137
|
-
if
|
138
|
-
|
137
|
+
if parsed_domain.is_a?(Regexp)
|
138
|
+
parsed_domain.match?(input)
|
139
139
|
else
|
140
140
|
domain == input
|
141
141
|
end
|
@@ -182,6 +182,13 @@ module OpenProject
|
|
182
182
|
raise ParseError, "Failed to load from json: #{e}"
|
183
183
|
end
|
184
184
|
|
185
|
+
def parsed_domain
|
186
|
+
@parsed_domain = read_domain!(domain) unless defined?(@parsed_domain)
|
187
|
+
|
188
|
+
@parsed_domain
|
189
|
+
end
|
190
|
+
|
191
|
+
|
185
192
|
private
|
186
193
|
|
187
194
|
def load_attributes(attributes)
|
@@ -191,7 +198,7 @@ module OpenProject
|
|
191
198
|
@subscriber = attributes["subscriber"]
|
192
199
|
@mail = attributes["mail"]
|
193
200
|
@company = attributes["company"]
|
194
|
-
@domain =
|
201
|
+
@domain = attributes["domain"]
|
195
202
|
|
196
203
|
date_attribute_keys.each do |attr|
|
197
204
|
value = attributes[attr]
|
@@ -253,7 +260,7 @@ module OpenProject
|
|
253
260
|
version
|
254
261
|
end
|
255
262
|
|
256
|
-
def read_domain(input)
|
263
|
+
def read_domain!(input)
|
257
264
|
return input if input.nil? || !(input.start_with?('/') && input.end_with?('/'))
|
258
265
|
|
259
266
|
# Omit the slashes of the input
|
@@ -272,6 +279,7 @@ module OpenProject
|
|
272
279
|
@domain_required_from_version ||= Gem::Version.new('2.0')
|
273
280
|
end
|
274
281
|
|
282
|
+
|
275
283
|
##
|
276
284
|
# Reprieve was introduced in version 2.2.0 so could only be set
|
277
285
|
# during generation from then onwards. All tokens before that
|