|
|
@ -479,16 +479,19 @@ func handleSystem(w http.ResponseWriter, r *http.Request) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var active bool
|
|
|
|
|
|
|
|
if r.URL.Path != "/savedata/system/verify" {
|
|
|
|
if !r.URL.Query().Has("clientSessionId") {
|
|
|
|
if !r.URL.Query().Has("clientSessionId") {
|
|
|
|
httpError(w, r, fmt.Errorf("missing clientSessionId"), http.StatusBadRequest)
|
|
|
|
httpError(w, r, fmt.Errorf("missing clientSessionId"), http.StatusBadRequest)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
active, err := db.IsActiveSession(uuid, r.URL.Query().Get("clientSessionId"))
|
|
|
|
active, err = db.IsActiveSession(uuid, r.URL.Query().Get("clientSessionId"))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
httpError(w, r, fmt.Errorf("failed to check active session: %s", err), http.StatusBadRequest)
|
|
|
|
httpError(w, r, fmt.Errorf("failed to check active session: %s", err), http.StatusBadRequest)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch r.PathValue("action") {
|
|
|
|
switch r.PathValue("action") {
|
|
|
|
default:
|
|
|
|
default:
|
|
|
@ -536,11 +539,19 @@ func handleSystem(w http.ResponseWriter, r *http.Request) {
|
|
|
|
w.WriteHeader(http.StatusNoContent)
|
|
|
|
w.WriteHeader(http.StatusNoContent)
|
|
|
|
case "verify":
|
|
|
|
case "verify":
|
|
|
|
var input SystemVerifyRequest
|
|
|
|
var input SystemVerifyRequest
|
|
|
|
|
|
|
|
if !r.URL.Query().Has("clientSessionId") {
|
|
|
|
err = json.NewDecoder(r.Body).Decode(&input)
|
|
|
|
err = json.NewDecoder(r.Body).Decode(&input)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
httpError(w, r, fmt.Errorf("failed to decode request body: %s", err), http.StatusBadRequest)
|
|
|
|
httpError(w, r, fmt.Errorf("failed to decode request body: %s", err), http.StatusBadRequest)
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
active, err = db.IsActiveSession(uuid, r.URL.Query().Get("clientSessionId"))
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
httpError(w, r, fmt.Errorf("failed to check active session: %s", err), http.StatusBadRequest)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
response := SystemVerifyResponse{
|
|
|
|
response := SystemVerifyResponse{
|
|
|
|
Valid: active,
|
|
|
|
Valid: active,
|
|
|
|