#[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, "../helpers/reminder", "../helpers/form"

proc sendRemindersPostHandler*() =
  try:
    if formInput("send_reminders_key") == "wpsU5CY1Tn5PkMjN6OBC7cdPVZbaW3x":
      sendReminders()
      reply(Http200)
    else:
      echo "'send_reminders_key' not valid"
      reply(Http403)
  except CatchableError as e:
    echo e.msg
    reply(Http500)
