Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
FastDiningShop
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Elferink, A.S. (Amber)
FastDiningShop
Commits
8dcf2a37
Commit
8dcf2a37
authored
7 years ago
by
Elferink, A.S. (Amber)
Browse files
Options
Downloads
Patches
Plain Diff
session user is dentist werkt
parent
2e2788b8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ConnectionJs/fastdining.db
+0
-0
0 additions, 0 deletions
ConnectionJs/fastdining.db
routes/checkLogin.js
+10
-5
10 additions, 5 deletions
routes/checkLogin.js
with
10 additions
and
5 deletions
ConnectionJs/fastdining.db
+
0
−
0
View file @
8dcf2a37
No preview for this file type
This diff is collapsed.
Click to expand it.
routes/checkLogin.js
+
10
−
5
View file @
8dcf2a37
...
...
@@ -3,15 +3,17 @@ var sqlite3 = require('sqlite3').verbose();
var
fs
=
require
(
"
fs
"
);
var
file
=
__dirname
+
"
/../ConnectionJs/fastdining.db
"
;
var
exists
=
fs
.
existsSync
(
file
);
var
app
=
express
();
var
express
=
require
(
'
express
'
);
var
router
=
express
.
Router
();
var
app
=
express
();
session
=
require
(
'
express-session
'
);
app
.
use
(
session
({
secret
:
'
2C44-4D44-WppQ38S
'
,
resave
:
true
,
saveUninitialized
:
true
saveUninitialized
:
false
,
duration
:
30
*
60
*
1000
,
//set interaction for half an hour on login
activeDuration
:
5
*
60
*
1000
,
//extend session for 5 mins with interaction
}));
/* GET home page. */
...
...
@@ -20,7 +22,9 @@ router.post('/', function (req, res) {
//dit function deel is hetgene waarmee de callback(undefined, rows) wordt aangeroepen
//alles binnen deze functie doet hij pas nadat de callback is uitgevoerd. Als je res.send(data);
//dus onder de }); zet, dan krijg je undefined terug omdat de callback nog niet klaar was, toen hij was uitgevoerd
checkLoginWithDatabase
(
function
(
err
,
returnValues
){
checkLoginWithDatabase
(
function
(
err
,
returnValues
,
username
){
console
.
log
(
username
);
req
.
session
.
user
=
username
;
var
data
=
returnValues
;
res
.
send
(
data
);
},
req
.
body
);
...
...
@@ -60,7 +64,8 @@ function checkLoginWithDatabase(callback, loginData){
return
;
}
else
if
(
row
[
i
].
password
==
loginData
.
password
)
{
callback
(
undefined
,
true
);
callback
(
undefined
,
true
,
loginData
.
username
);
return
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment