CyberNinjas / TallyCTF

Capture-The-Flag Scoreboard & CTF Event Running Software.
GNU General Public License v3.0
7 stars 5 forks source link

Event Title cannot be blank #16

Open Jnchi opened 4 years ago

Jnchi commented 4 years ago

Location: Events > New Event > Create Event

POST /api/ctfEvents HTTP/1.1
Host: jnchi-tallyctf.herokuapp.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json;charset=utf-8
Content-Length: 766
Origin: https://jnchi-tallyctf.herokuapp.com
DNT: 1
Connection: close
Referer: https://jnchi-tallyctf.herokuapp.com/ctfEvents/create
Cookie: sessionId=s%3AyaSzZjoXR4gP3tA1R2XekeySG0VXDNaW.U6OuNgt1wHD%2FoH5jF5qY9PsIN9ARFBc9iPz%2BWOrTl%2Fk; io=rMUa0PUkvL05ukfoAAAc

{"title":"Foo","description":"Bar","start":"2019-11-07 09:11:53","end":"2019-11-09 09:11:59","registrationStart":"2019-11-01 09:12:01","registrationEnd":"2019-11-06 09:12:03","challenges":[{"numberOfSubmissions":3,"affectedMachine":"None","challengeFormat":"short-answer","challengeType":"text","points":10,"category":"Bar","description":"Baz","name":"Foo","lastModifiedBy":"5db9cc5d03499016009eb5b6","createdBy":"5db9cc5d03499016009eb5b6","niceCategories":[],"answers":[{"value":"fizzbuzz","_id":"5db9cdaae66473160042d619","correct":true,"regex":false}],"submissions":[],"files":[],"lastModified":"2019-10-30T17:51:38.686Z","created":"2019-10-30T17:51:38.662Z"}],"teams":[],"users":["5db9cdd1e66473160042d61f","5db9cdb6e66473160042d61b","5db9cc5d03499016009eb5b6"]}
HTTP/1.1 400 Bad Request
Server: Cowboy
Connection: close
Vary: X-HTTP-Method-Override, Accept-Encoding
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Download-Options: noopen
Strict-Transport-Security: max-age=15778476000; includeSubDomains
Content-Type: application/json; charset=utf-8
Content-Length: 41
Etag: W/"29-GSsxllKSJbRild1C58+SAZljuT8"
Date: Thu, 31 Oct 2019 13:12:16 GMT
Via: 1.1 vegur

{"message":"Event Title cannot be blank"}
Jnchi commented 4 years ago

Source: https://github.com/CyberNinjas/TallyCTF/blob/misc-updates/modules/ctfEvents/server/models/ctfEvent.server.model.js#L19

Jnchi commented 4 years ago

Events can be created manually by importing the following JSON document into MongoDB.

{
  "_id": "5dbae7478e986f602e35b921",
  "teams": [],
  "users": [],
  "challenges": [],
  "settings": {
    "maxTries": [],
    "userAuths": []
  },
  "registrationStart": "2019-10-31T13:53:11.733Z",
  "end": "2019-10-31T13:52:16.000Z",
  "start": "2019-10-31T13:53:11.733Z",
  "description": "Bar",
  "title": "Foo",
  "created": "2019-10-31T13:53:11.733Z",
  "__v": 0
}
Jnchi commented 4 years ago
diff --git a/modules/ctfEvents/server/models/ctfEvent.server.model.js b/modules/ctfEvents/server/models/ctfEvent.server.model.js
index ee8e01a..f62beb6 100644
--- a/modules/ctfEvents/server/models/ctfEvent.server.model.js
+++ b/modules/ctfEvents/server/models/ctfEvent.server.model.js
@@ -15,8 +15,7 @@ var CtfEventSchema = new Schema({
   title: {
     type: String,
     default: '',
-    trim: true,
-    required: 'Event Title cannot be blank'
+    trim: true
   },
   description:{
     type: String,