#[Copyright 2025 ITwrx.
This file is part of Simple Site Manager.
Simple Site Manager is released under the GNU Affero General Public License 3.0.
See COPYING or <https://www.gnu.org/licenses/> for details.]#

import guildenstern/httpserver, "../models/user_session", "../helpers/form"

proc userSessionDeletePostHandler*() =
  try:
    if formInput("delete_user_sessions_key") == "XR5yLeigb4PFXOZBh3PBOuQXc8d7NE6":
      deleteUserSessions()
      reply(Http200)
    else:
      echo "'delete_user_sessions_key' not valid"
      reply(Http403)
  except CatchableError as e:
    echo e.msg
    reply(Http500)
