Archived
1
0

routes: Redirect from /login when auth is disabled (#2456)

Sometimes I start with auth but then disable. Now I can just reload the
login page in my browser to be greeted with code-server.
This commit is contained in:
Anmol Sethi 2020-12-14 12:33:36 -05:00 committed by GitHub
parent ed01515af1
commit 244afa402e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ import { plural } from "../../common/util"
import { AuthType, DefaultedArgs } from "../cli"
import { rootPath } from "../constants"
import { Heart } from "../heart"
import { replaceTemplates } from "../http"
import { replaceTemplates, redirect } from "../http"
import { PluginAPI } from "../plugin"
import { getMediaMime, paths } from "../util"
import { WebsocketRequest } from "../wsRouter"
@ -112,6 +112,10 @@ export const register = async (
if (args.auth === AuthType.Password) {
app.use("/login", login.router)
} else {
app.all("/login", (req, res) => {
redirect(req, res, "/", {})
})
}
app.use("/proxy", proxy.router)