From 9553724c8286eea7d7e8217d5f9f1c762c9b7c82 Mon Sep 17 00:00:00 2001 From: Jonas Mueller Date: Fri, 25 Feb 2022 15:02:30 +0000 Subject: Show notice & error code on failed login Upon failed login, this patch sets the status code to 401 and provides a Notice to show in login.html --- plugins/base/routes.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/base/routes.go b/plugins/base/routes.go index f426c96..255faa5 100644 --- a/plugins/base/routes.go +++ b/plugins/base/routes.go @@ -366,7 +366,8 @@ func handleLogin(ctx *alps.Context) error { s, err := ctx.Server.Sessions.Put(username, password) if err != nil { if _, ok := err.(alps.AuthError); ok { - return ctx.Render(http.StatusOK, "login.html", &renderData) + renderData.BaseRenderData.GlobalData.Notice = "Failed to login!" + return ctx.Render(http.StatusUnauthorized, "login.html", &renderData) } return fmt.Errorf("failed to put connection in pool: %v", err) } -- cgit v1.2.3