                               email)]
         (call-sql "set_mailing_list" (:user_id user) false)
         (send-mail [email] nil nil "Successfully unsubscribed from CEO mailing list" email-msg "text/plain")
-        {:status  200
-         :headers {"Content-Type" "application/json"}
-         :body    ""})
-      {:status  200
-       :headers {"Content-Type" "application/json"}
-       :body    "There is no user with that email address."})))
+        (data-response ""))
+      (data-response "There is no user with that email address."))))

                            (.toSeconds)
                            (- (get-mailing-list-interval)))]
    (if (pos? remaining-time)
      {:status  200
       :headers {"Content-Type" "application/json"}
       :body    (str "You must wait " remaining-time " more seconds before sending another message.")}
      (if (or (str/blank? subject) (str/blank? body))
        {:status  200
         :headers {"Content-Type" "application/json"}
         :body    "Subject and Body are mandatory fields."}
        (let [emails (mapv :email (call-sql "get_all_mailing_list_users"))]
          (send-to-mailing-list emails subject body "text/html")
          (set-mailing-list-last-sent! (LocalDateTime/now))
          {:status  200
           :headers {"Content-Type" "application/json"}
           :body    ""})))))

(defn unsubscribe-from-mailing-list [request]
  (let [email (-> request :params :email)]

        current-password      (:currentPassword params)
        on-mailing-list?      (boolean (:onMailingList params))]
    (if-let [error-msg (get-update-account-errors stored-email email password password-confirmation current-password)]
      (data-response error-msg)
      (do
        (when (and (not (str/blank? email)) (not= email stored-email))
          (update-email user-id stored-email email))
        (when (not (str/blank? password))
          (call-sql "update_password" stored-email password))
        (call-sql "set_mailing_list" user-id on-mailing-list?)
        (data-response "")))))

(defn get-password-reset-key [request]
  (let [email (-> request :params :email)]
