diff options
author | Alex Auvolat <alex@adnab.me> | 2022-12-06 16:01:38 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-12-06 16:01:38 +0100 |
commit | 832c17a3a9f6277e7921f4e811401d5478755ff9 (patch) | |
tree | e5e2b0bd1d0337937a0ce5f207ba2523df7c332c /plugins | |
parent | e045227527de36cdbb954e00a4cf8de041a25828 (diff) | |
parent | f01fbcbc48db5e65d69a0ebd9d7cb0deb378cf13 (diff) | |
download | alps-832c17a3a9f6277e7921f4e811401d5478755ff9.tar.gz alps-832c17a3a9f6277e7921f4e811401d5478755ff9.zip |
Merge branch 'master' into deuxfleurs
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/base/routes.go | 13 | ||||
-rw-r--r-- | plugins/carddav/routes.go | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/plugins/base/routes.go b/plugins/base/routes.go index f426c96..52d1681 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) } @@ -1023,6 +1024,11 @@ func handleMove(ctx *alps.Context) error { return echo.NewHTTPError(http.StatusBadRequest, err) } + if len(uids) == 0 { + ctx.Session.PutNotice("No messages selected.") + return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName))) + } + to := formOrQueryParam(ctx, "to") if to == "" { return echo.NewHTTPError(http.StatusBadRequest, "missing 'to' form parameter") @@ -1070,6 +1076,11 @@ func handleDelete(ctx *alps.Context) error { return echo.NewHTTPError(http.StatusBadRequest, err) } + if len(uids) == 0 { + ctx.Session.PutNotice("No messages selected.") + return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName))) + } + err = ctx.Session.DoIMAP(func(c *imapclient.Client) error { if err := ensureMailboxSelected(c, mboxName); err != nil { return err diff --git a/plugins/carddav/routes.go b/plugins/carddav/routes.go index fe7c37d..6c8a85f 100644 --- a/plugins/carddav/routes.go +++ b/plugins/carddav/routes.go @@ -141,7 +141,7 @@ func registerRoutes(p *plugin) { var ao *carddav.AddressObject var card vcard.Card if addressObjectPath != "" { - ao, err := c.GetAddressObject(addressObjectPath) + ao, err = c.GetAddressObject(addressObjectPath) if err != nil { return fmt.Errorf("failed to query CardDAV address: %v", err) } |