Now automatically redirects after login
This commit is contained in:
parent
cb6c5293e1
commit
5a009f9d00
@ -150,9 +150,10 @@ function testAuthentication(request, response) {
|
|||||||
// Create session
|
// Create session
|
||||||
const sessionId = createSession();
|
const sessionId = createSession();
|
||||||
|
|
||||||
response.writeHead(200, {
|
response.writeHead(303, {
|
||||||
'Content-Type': 'text/html',
|
'Content-Type': 'text/html',
|
||||||
'Set-Cookie': 'sesid=' + sessionId
|
'Set-Cookie': 'sesid=' + sessionId,
|
||||||
|
'Location': request.headers.referer
|
||||||
});
|
});
|
||||||
response.end('Access granted! You\'re in!');
|
response.end('Access granted! You\'re in!');
|
||||||
return;
|
return;
|
||||||
@ -204,6 +205,7 @@ function serverStaticFiles(request, response) {
|
|||||||
|
|
||||||
var server = http.createServer(function (request, response) {
|
var server = http.createServer(function (request, response) {
|
||||||
// Handle requests here...
|
// Handle requests here...
|
||||||
|
console.log(request.headers.referer);
|
||||||
|
|
||||||
// If request is trying to authenticate
|
// If request is trying to authenticate
|
||||||
if (request.url == '/api--authenticate') {
|
if (request.url == '/api--authenticate') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user