aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJonas Mueller <jonas@tigger.cloud>2022-02-25 15:02:30 +0000
committerSimon Ser <contact@emersion.fr>2022-02-25 16:18:42 +0100
commit9553724c8286eea7d7e8217d5f9f1c762c9b7c82 (patch)
treecf3bc64510d49ba3b09a038a84a5fa0d2b12e4a2 /plugins
parentd4c35f3c3157bece8e50fd95f2ee1081be30d7ae (diff)
downloadalps-9553724c8286eea7d7e8217d5f9f1c762c9b7c82.tar.gz
alps-9553724c8286eea7d7e8217d5f9f1c762c9b7c82.zip
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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/base/routes.go3
1 files changed, 2 insertions, 1 deletions
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)
}