Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjoeio committed Jun 4, 2021
1 parent ba8c796 commit 20786db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/node/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ export const ensureAuthenticated = async (
*/
export const authenticated = async (req: express.Request): Promise<boolean> => {
switch (req.args.auth) {
case AuthType.None:
case AuthType.None: {
return true
case AuthType.Password:
}
case AuthType.Password: {
// The password is stored in the cookie after being hashed.
const hashedPasswordFromArgs = req.args["hashed-password"]
const passwordMethod = getPasswordMethod(hashedPasswordFromArgs)
Expand All @@ -77,8 +78,10 @@ export const authenticated = async (req: express.Request): Promise<boolean> => {
}

return await isCookieValid(isCookieValidArgs)
default:
}
default: {
throw new Error(`Unsupported auth type ${req.args.auth}`)
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/node/util.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { logger } from "@coder/logger"
import * as argon2 from "argon2"
import * as cp from "child_process"
import * as crypto from "crypto"
import * as argon2 from "argon2"
import envPaths from "env-paths"
import { promises as fs } from "fs"
import * as net from "net"
import * as os from "os"
import * as path from "path"
import safeCompare from "safe-compare"
import * as util from "util"
import xdgBasedir from "xdg-basedir"
import safeCompare from "safe-compare"
import { logger } from "@coder/logger"

export interface Paths {
data: string
Expand Down

0 comments on commit 20786db

Please sign in to comment.