Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Tabu-Middleware
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dennis Willers
Tabu-Middleware
Commits
b589c929
Commit
b589c929
authored
Dec 29, 2020
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Secure isSpielSession query
parent
9d6713fe
Pipeline
#285
passed with stages
in 2 minutes and 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
events.js
events.js
+18
-14
No files found.
events.js
View file @
b589c929
...
@@ -5,10 +5,9 @@ function createRouter(db) {
...
@@ -5,10 +5,9 @@ function createRouter(db) {
// the routes are defined here
// the routes are defined here
router
.
post
(
'
/addSpielSession
'
,
(
req
,
res
)
=>
{
router
.
post
(
'
/addSpielSession
'
,
(
req
,
res
)
=>
{
var
spielname
=
req
.
body
.
spielname
;
if
(
spielname
.
match
(
/^
[
0-9a-zA-Z
]
+$/
)
!=
null
)
{
if
(
spielname
.
match
(
/^
[
0-9a-zA-Z
]
+$/
)
!=
null
)
{
db
.
query
(
db
.
query
(
'
INSERT INTO Spielsession (SessionName) VALUES (
\
"
'
+
req
.
body
.
spielname
+
'
\
");
'
,
'
INSERT INTO Spielsession (SessionName) VALUES (
\
"
'
+
spielname
+
'
\
");
'
,
(
error
)
=>
{
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
...
@@ -24,21 +23,26 @@ function createRouter(db) {
...
@@ -24,21 +23,26 @@ function createRouter(db) {
});
});
router
.
post
(
'
/isSpielSession
'
,
(
req
,
res
)
=>
{
router
.
post
(
'
/isSpielSession
'
,
(
req
,
res
)
=>
{
db
.
query
(
var
spielname
=
req
.
body
.
spielname
;
'
SELECT SessionName FROM Spielsession WHERE SessionName =
\'
'
+
req
.
body
.
spielname
+
'
\'
;
'
,
if
(
spielname
.
match
(
/^
[
0-9a-zA-Z
]
+$/
)
!=
null
)
{
(
error
,
results
)
=>
{
db
.
query
(
if
(
error
)
{
'
SELECT SessionName FROM Spielsession WHERE SessionName =
\'
'
+
spielname
+
'
\'
;
'
,
console
.
log
(
error
);
(
error
,
results
)
=>
{
res
.
status
(
500
).
json
({
status
:
'
error
'
});
if
(
error
)
{
}
else
{
console
.
log
(
error
);
if
(
results
.
length
>
0
)
{
res
.
status
(
500
).
json
({
status
:
'
error
'
});
res
.
status
(
200
).
json
({
status
:
'
true
'
});
}
else
{
}
else
{
res
.
status
(
200
).
json
({
status
:
'
false
'
});
if
(
results
.
length
>
0
)
{
res
.
status
(
200
).
json
({
status
:
'
true
'
});
}
else
{
res
.
status
(
200
).
json
({
status
:
'
false
'
});
}
}
}
}
}
}
);
);
}
else
{
res
.
status
(
500
).
json
({
status
:
'
error
'
});
}
});
});
router
.
get
(
'
/SpielSession
'
,
function
(
req
,
res
)
{
router
.
get
(
'
/SpielSession
'
,
function
(
req
,
res
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment