8000 routes: Redirect from /login when auth is disabled by nhooyr · Pull Request #2456 · coder/code-server · GitHub
[go: up one dir, main page]

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
routes: Redirect from /login when auth is disabled
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.
  • Loading branch information
nhooyr committed Dec 14, 2020
commit 5f1075d4e1a5ae696026a7fec7ac1190bad6183b
6 changes: 5 additions & 1 deletion src/node/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
0