gamekey 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/bin/gamekey +1 -1
- data/lib/gamekey.rb +10 -0
- data/lib/gamekey/version.rb +1 -1
- data/lib/reference.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e1811ae91ca0c3a3e8bf367102245dc6966f0e3
|
4
|
+
data.tar.gz: b10f545ec4a409351660c5d594ca0178e9ac298d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c2bb15f1b1ba226d5dd5aa4360b0fbcd3a089f7a82a4f531553e867454c68dcb45996edb5d6fa04d3f63a35114c2d66d9944b09fd056b35b413ee58512820f6
|
7
|
+
data.tar.gz: 1a9bfe61b13773a46070d54e13de7f880389f31b8ed534dbfb1bd1cbce7f3000348c892053fdcc4c63ceff3e15c46adbb3316528341c54b38fcecf4e02437770
|
data/README.md
CHANGED
@@ -134,6 +134,10 @@ So you can get all the sources via the following git command.
|
|
134
134
|
|
135
135
|
## Changelog
|
136
136
|
|
137
|
+
### Version 0.0.3
|
138
|
+
POST /user checks now that a password and a user name is provided.
|
139
|
+
Thanks again to Jan Lukas Deichmann figuring out this bug (WebTech SoSe 2016).
|
140
|
+
|
137
141
|
### Version 0.0.2
|
138
142
|
POST /game checks now that a secret is provided.
|
139
143
|
Thanks to Jan Lukas Deichmann figuring out this bug (WebTech SoSe 2016).
|
data/bin/gamekey
CHANGED
data/lib/gamekey.rb
CHANGED
@@ -128,6 +128,16 @@ class GamekeyService
|
|
128
128
|
mail = params['mail']
|
129
129
|
id = SecureRandom.uuid
|
130
130
|
|
131
|
+
if (name == nil || name.empty?)
|
132
|
+
status 400
|
133
|
+
return "Bad Request: '#{name}' is not a valid name"
|
134
|
+
end
|
135
|
+
|
136
|
+
if (pwd == nil || pwd.empty?)
|
137
|
+
status 400
|
138
|
+
return "Bad Request: password must be provided and not be empty"
|
139
|
+
end
|
140
|
+
|
131
141
|
unless mail =~ Defaults::VALID_EMAIL_REGEX || mail == nil
|
132
142
|
status 400
|
133
143
|
return "Bad Request: '#{mail}' is not a valid email."
|
data/lib/gamekey/version.rb
CHANGED
data/lib/reference.rb
CHANGED
@@ -42,6 +42,13 @@ class GamekeyReferenceTests
|
|
42
42
|
|
43
43
|
uri = URI("#{@host}/user")
|
44
44
|
send = DateTime.now
|
45
|
+
|
46
|
+
res = Net::HTTP.post_form(uri, 'name' => @user)
|
47
|
+
return "#{error('POST', '/user', "PU-0")} Could create user '#{@user}' without password (should return HTTP code 400, was #{res.code})".red unless (res.code == "400")
|
48
|
+
|
49
|
+
res = Net::HTTP.post_form(uri, 'pwd' => 'secret')
|
50
|
+
return "#{error('POST', '/user', "PU-0a")} Could create user without name (should return HTTP code 400, was #{res.code})".red unless (res.code == "400")
|
51
|
+
|
45
52
|
res = Net::HTTP.post_form(uri, 'name' => @user, 'pwd' => @pwd)
|
46
53
|
|
47
54
|
return "#{error('POST', '/user', "PU-1")} Could not create user '#{@user}' (should return HTTP code 200, was #{res.code})".red unless (res.code == "200")
|
@@ -271,7 +278,7 @@ class GamekeyReferenceTests
|
|
271
278
|
name = "John Doe #{i}"
|
272
279
|
request.set_form_data({
|
273
280
|
"name" => name,
|
274
|
-
"pwd" => ""
|
281
|
+
"pwd" => "secret"
|
275
282
|
})
|
276
283
|
res = http.request(request)
|
277
284
|
return "#{error('POST', '/user', "SU-1")} Creating user with name '#{name}' failed while stress testing.\n#{res.body}".red unless res.code == "200"
|
@@ -286,7 +293,7 @@ class GamekeyReferenceTests
|
|
286
293
|
users.each do |user|
|
287
294
|
delete_user = Net::HTTP::Delete.new("/user/#{user['id']}")
|
288
295
|
delete_user.set_form_data({
|
289
|
-
"pwd" => ""
|
296
|
+
"pwd" => "secret"
|
290
297
|
})
|
291
298
|
res = http.request(delete_user)
|
292
299
|
return "#{error('DELETE', '/user/id', "SU-3")} Deleting user with id '#{user['name']} (#{user['id']})' failed while stress testing.\n#{res.body}".red unless res.code == "200"
|