Skip to content

Commit 208b984

Browse files
committed
fix cache on email update [fix #18]
1 parent 16cb49e commit 208b984

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/webserver/handlers.go

+8
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,9 @@ func (ws *WebServer) handlerPostMail(ctx *routing.Context) error {
687687
return jsonError(ctx, err, fasthttp.StatusInternalServerError)
688688
}
689689

690+
user.MailAddress = ""
691+
ws.cache.SetUserByID(user.UID, user)
692+
690693
return jsonResponse(ctx, nil, fasthttp.StatusOK)
691694
}
692695

@@ -738,6 +741,11 @@ func (ws *WebServer) handlerPostConfirmMail(ctx *routing.Context) error {
738741
return jsonError(ctx, err, fasthttp.StatusInternalServerError)
739742
}
740743

744+
if user, err := ws.cache.GetUserByID(data.UserID); err == nil && user != nil {
745+
user.MailAddress = data.MailAddress
746+
ws.cache.SetUserByID(user.UID, user)
747+
}
748+
741749
return jsonResponse(ctx, err, fasthttp.StatusOK)
742750
}
743751

0 commit comments

Comments
 (0)