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
fd9ef216
Commit
fd9ef216
authored
7 years ago
by
Elferink, A.S. (Amber)
Browse files
Options
Downloads
Patches
Plain Diff
voor het omschrijven naar redirect ipv send data
parent
d435778a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
routes/checkLogin.js
+20
-0
20 additions, 0 deletions
routes/checkLogin.js
with
20 additions
and
0 deletions
routes/checkLogin.js
+
20
−
0
View file @
fd9ef216
...
...
@@ -16,6 +16,21 @@ app.use(session({
activeDuration
:
5
*
60
*
1000
,
//extend session for 5 mins with interaction
}));
/*If a get or post loads a page, for instance /myprofile, it wil look if the person is authorised to see it using this.
*/
var
auth
=
function
(
req
,
res
,
next
,
user
)
{
if
(
req
.
session
&&
req
.
session
.
user
===
user
)
{
return
next
();
}
else
{
return
res
.
sendStatus
(
401
);
}
};
/* GET home page. */
router
.
post
(
'
/login
'
,
function
(
req
,
res
)
{
...
...
@@ -36,6 +51,11 @@ router.get('/logout', function (req, res) {
res
.
send
(
"
logout success!
"
);
});
router
.
get
(
'
/profile
'
,
auth
,
function
(
req
,
res
)
{
user
=
req
.
query
;
res
.
send
(
"
You can only see this after you've logged in.
"
)
});
module
.
exports
=
router
;
...
...
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