         on-mailing-list?      (boolean (:onMailingList params))]
     (if-let [error-msg (get-register-errors email password password-confirmation)]
       {:status  200
-       :headers {"Content-Type" "text/plain"}
+       :headers {"Content-Type" "application/json"}
        :body    error-msg}
       (let [user-id   (sql-primitive (call-sql "add_user" email password on-mailing-list?))
             timestamp (-> (DateTimeFormatter/ofPattern "yyyy/MM/dd HH:mm:ss")

                                  email email timestamp)]
        (send-mail [email] nil nil "Welcome to CEO!" email-msg "text/plain")
        {:status  200
         :headers {"Content-Type" "text/plain"}
         :body    ""
         :session {:userId   user-id
                   :userName email

(defn- update-email [user-id old-email new-email]
  (if (sql-primitive (call-sql "email_taken" new-email user-id))
    {:status  200
     :headers {"Content-Type" "application/json"}
     :body    (str "An account with the email " new-email " already exists.")}
    (do
      (call-sql "set_user_email" old-email new-email)
      {:status  200
       :headers {"Content-Type" "application/json"}
       :body    ""
       :session {:userName new-email}})))

