From 85d3adc3e3917d2919b22aa573bfa11a5ec15c91 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Wed, 13 Feb 2019 23:31:41 +0100 Subject: [PATCH] Check linting issues on hotreload and fix remaining ones. --- scripts/authelia-scripts-start | 12 ++++++++---- server/src/lib/authentication/AuthenticationError.ts | 2 +- server/src/lib/routes/firstfactor/post.ts | 8 ++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/authelia-scripts-start b/scripts/authelia-scripts-start index f28cc635..b6a5d05b 100755 --- a/scripts/authelia-scripts-start +++ b/scripts/authelia-scripts-start @@ -44,9 +44,12 @@ function startServer() { console.log('Authelia is interrupted. Consider removing ' + AUTHELIA_INTERRUPT_FILENAME + ' if it\'s not expected.'); return; } - serverProcess = spawn('./scripts/run-dev-server.sh', [`test/suites/${program.suite}/config.yml`]); - serverProcess.stdout.pipe(process.stdout); - serverProcess.stderr.pipe(process.stderr); + exec('./node_modules/.bin/tslint', ['-c', 'server/tslint.json', '-p', 'server/tsconfig.json']) + .then(function() { + serverProcess = spawn('./scripts/run-dev-server.sh', [`test/suites/${program.suite}/config.yml`]); + serverProcess.stdout.pipe(process.stdout); + serverProcess.stderr.pipe(process.stderr); + }); } let clientProcess; @@ -97,7 +100,8 @@ function killClient(onExit) { } function generateConfigurationSchema() { - exec('./node_modules/.bin/typescript-json-schema -o server/src/lib/configuration/Configuration.schema.json --strictNullChecks --required server/tsconfig.json Configuration'); + return ixec('./node_modules/.bin/typescript-json-schema', + ['-o', 'server/src/lib/configuration/Configuration.schema.json', '--strictNullChecks', '--required', 'server/tsconfig.json', 'Configuration']); } function reload(path) { diff --git a/server/src/lib/authentication/AuthenticationError.ts b/server/src/lib/authentication/AuthenticationError.ts index 8203b345..9285ac49 100644 --- a/server/src/lib/authentication/AuthenticationError.ts +++ b/server/src/lib/authentication/AuthenticationError.ts @@ -8,4 +8,4 @@ class AuthenticationError extends Error { } } -export default AuthenticationError \ No newline at end of file +export default AuthenticationError; \ No newline at end of file diff --git a/server/src/lib/routes/firstfactor/post.ts b/server/src/lib/routes/firstfactor/post.ts index 2a2671d4..f6ec8a66 100644 --- a/server/src/lib/routes/firstfactor/post.ts +++ b/server/src/lib/routes/firstfactor/post.ts @@ -63,8 +63,8 @@ export default function (vars: ServerVariables) { vars.regulator.mark(username, true); }) .then(function() { - const targetUrl = ObjectPath.get(req, 'headers.x-target-url', null); - + const targetUrl = ObjectPath.get(req, "headers.x-target-url", undefined); + if (!targetUrl) { res.status(204); res.send(); @@ -76,12 +76,12 @@ export default function (vars: ServerVariables) { const resObject: Object = { domain: resource.domain, resource: resource.path, - } + }; const subject: Subject = { user: authSession.userid, groups: authSession.groups - } + }; const authorizationLevel = vars.authorizer.authorization(resObject, subject); if (authorizationLevel <= AuthorizationLevel.ONE_FACTOR) {