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
This commit is contained in:
parent
d4c35f3c31
commit
9553724c82
1 changed files with 2 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue