aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-14 17:37:13 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-14 17:37:13 -0400
commitb5a7bbe3816faa9cc80852aa49a86b0df63174f5 (patch)
tree25f451942610ea217c4f5b6e54f3a5d73783626e
parent2c2343b48df587ce205b14d24133d8280abc1a62 (diff)
downloadAtlas-b5a7bbe3816faa9cc80852aa49a86b0df63174f5.tar.gz
Atlas-b5a7bbe3816faa9cc80852aa49a86b0df63174f5.zip
pkg/api/api0: Set last server id in /client/auth_with_self
-rw-r--r--pkg/api/api0/client.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/api/api0/client.go b/pkg/api/api0/client.go
index f72a874..a5ecbda 100644
--- a/pkg/api/api0/client.go
+++ b/pkg/api/api0/client.go
@@ -381,6 +381,21 @@ func (h *Handler) handleClientAuthWithSelf(w http.ResponseWriter, r *http.Reques
}
}
+ acct.LastServerID = "self"
+
+ if err := h.AccountStorage.SaveAccount(acct); err != nil {
+ hlog.FromRequest(r).Error().
+ Err(err).
+ Uint64("uid", uid).
+ Msgf("failed to save account to storage")
+ respJSON(w, r, http.StatusInternalServerError, map[string]any{
+ "success": false,
+ "error": ErrorCode_INTERNAL_SERVER_ERROR,
+ "msg": ErrorCode_INTERNAL_SERVER_ERROR.Message(),
+ })
+ return
+ }
+
obj := map[string]any{
"success": true,
"id": strconv.FormatUint(acct.UID, 10),