                        :body (str "A user is already registered with that email.\n"
                                   "Log in and try joining"))
                 (let [id (register-user email group-id)
-                      referer (get-in req [:headers "referer"] (env :site-url))
+                      referer (get-in req [:headers "referer"] (config :site-url))
                       [proto _ referrer-domain] (string/split referer #"/")]
                   {:status 302 :headers {"Location" (str proto "//" referrer-domain)}
                    :session (assoc (req :session) :user-id id)

                                         :avatar avatar-url
                                         :nickname nickname
                                         :password password})
                  referer (get-in req [:headers "referer"] (env :site-url))
                  [proto _ referrer-domain] (string/split referer #"/")]
              (do
                (db/user-add-to-group! (user :id) (invite :group-id))

        (if-let [user (db/user-by-id user-id)]
          (if-let [err (:error (invites/verify-reset-nonce user token))]
            (assoc fail :body err)
            (let [referer (get-in req [:headers "referer"] (config :site-url))
                  [proto _ referrer-domain] (string/split referer #"/")]
              (db/set-user-password! (user :id) new-password)
              {:status 301
