From 3f648b55e6669a46d859860b74e3f8ff1492d2f7 Mon Sep 17 00:00:00 2001 From: Pancakes Date: Mon, 7 Jul 2025 21:03:31 -0400 Subject: [PATCH] Create new session on password change --- api/endpoints.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api/endpoints.go b/api/endpoints.go index 478b434..e6dbc09 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -134,7 +134,20 @@ func handleAccountChangePW(w http.ResponseWriter, r *http.Request) { return } - w.WriteHeader(http.StatusOK) + username, err := db.FetchUsernameFromUUID(uuid) + if err != nil { + httpError(w, r, err, http.StatusInternalServerError) + return + } + + // create a new session with these credentials + response, err := account.Login(username, r.Form.Get("password")) + if err != nil { + httpError(w, r, err, http.StatusInternalServerError) + return + } + + writeJSON(w, r, response) } func handleAccountLogout(w http.ResponseWriter, r *http.Request) {