Add minor improvements on how logout is handled

The profile-id is now required on the body of logout request
This commit is contained in:
Andrey Antukh 2024-06-11 10:51:38 +02:00
parent 3d7f399a50
commit 6896a4e9f0
2 changed files with 21 additions and 8 deletions

View file

@ -130,12 +130,21 @@
;; ---- COMMAND: Logout
(def ^:private schema:logout
[:map {:title "logoug"}
[:profile-id {:optional true} ::sm/uuid]])
(sv/defmethod ::logout
"Clears the authentication cookie and logout the current session."
{::rpc/auth false
::doc/added "1.15"}
[cfg _]
(rph/with-transform {} (session/delete-fn cfg)))
::doc/changes [["2.1" "Now requires profile-id passed in the body"]]
::doc/added "1.0"
::sm/params schema:logout}
[cfg params]
(if (= (:profile-id params)
(::rpc/profile-id params))
(rph/with-transform {} (session/delete-fn cfg))
{}))
;; ---- COMMAND: Recover Profile