deepsource-autofix-76c6eb20
Dan Gowans 2022-10-31 12:03:28 -04:00
parent 52d1e87c4e
commit 78344b4e35
8 changed files with 35 additions and 27 deletions

View File

@ -21,6 +21,7 @@
],
"rules": {
"node/no-missing-import": "off",
"node/no-unpublished-import": "off",
"unicorn/consistent-function-scoping": "warn",
"unicorn/empty-brace-spaces": "off",
"unicorn/filename-case": [

4
app.js
View File

@ -130,10 +130,10 @@ app.all(urlPrefix + "/keepAlive", (_request, response) => {
app.use(urlPrefix + "/login", routerLogin);
app.get(urlPrefix + "/logout", (request, response) => {
if (request.session.user && request.cookies[sessionCookieName]) {
request.session.destroy(null);
request.session = undefined;
request.session.destroy(() => {
response.clearCookie(sessionCookieName);
response.redirect(urlPrefix + "/");
});
}
else {
response.redirect(urlPrefix + "/login");

5
app.ts
View File

@ -233,11 +233,10 @@ app.use(urlPrefix + "/login", routerLogin);
app.get(urlPrefix + "/logout", (request, response) => {
if (request.session.user && request.cookies[sessionCookieName]) {
// eslint-disable-next-line unicorn/no-null
request.session.destroy(null);
request.session = undefined;
request.session.destroy(() => {
response.clearCookie(sessionCookieName);
response.redirect(urlPrefix + "/");
});
} else {
response.redirect(urlPrefix + "/login");
}

View File

@ -10,20 +10,25 @@ const onError = (error) => {
throw error;
}
switch (error.code) {
case "EACCES":
case "EACCES": {
debugWWW("Requires elevated privileges");
process.exit(1);
case "EADDRINUSE":
}
case "EADDRINUSE": {
debugWWW("Port is already in use.");
process.exit(1);
default:
}
default: {
throw error;
}
}
};
const onListening = (server) => {
const addr = server.address();
if (addr) {
const bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port.toString();
debugWWW("Listening on " + bind);
}
};
const httpPort = configFunctions.getProperty("application.httpPort");
if (httpPort) {
@ -39,6 +44,5 @@ exitHook(() => {
if (httpServer) {
debugWWW("Closing HTTP");
httpServer.close();
httpServer = undefined;
}
});

View File

@ -26,29 +26,33 @@ const onError = (error: ServerError) => {
// handle specific listen errors with friendly messages
switch (error.code) {
// eslint-disable-next-line no-fallthrough
case "EACCES":
case "EACCES": {
debugWWW("Requires elevated privileges");
process.exit(1);
// break;
}
// eslint-disable-next-line no-fallthrough
case "EADDRINUSE":
case "EADDRINUSE": {
debugWWW("Port is already in use.");
process.exit(1);
// break;
}
// eslint-disable-next-line no-fallthrough
default:
default: {
throw error;
}
}
};
const onListening = (server: http.Server) => {
const addr = server.address();
if (addr) {
const bind = typeof addr === "string" ? "pipe " + addr : "port " + addr.port.toString();
debugWWW("Listening on " + bind);
}
};
/**
@ -74,6 +78,5 @@ exitHook(() => {
if (httpServer) {
debugWWW("Closing HTTP");
httpServer.close();
httpServer = undefined;
}
});

View File

@ -1,5 +1,3 @@
/* eslint-disable node/no-unpublished-import */
import { defineConfig } from "cypress";
export default defineConfig({

View File

@ -65,7 +65,7 @@ router
isAuthenticated = await authenticationFunctions.authenticate(userName, passwordPlain);
}
let userObject: recordTypes.User;
let userObject: recordTypes.User | undefined;
if (isAuthenticated) {
const userNameLowerCase = userName.toLowerCase();

View File

@ -4,9 +4,12 @@ export interface LOS {
mapKey: string,
contextualClass: "success" | "danger"
) => void;
initializeDatePickers: (containerElement: HTMLElement) => void;
initializeTimePickers: (containerElement: HTMLElement) => void;
initializeUnlockFieldButtons: (containerElement: HTMLElement) => void;
populateAliases: (containerElement: HTMLElement) => void;
getRandomColor: (seedString: string) => string;
}