         (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"] (env :site-url))
+            (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

                       :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))
                      [proto _ referrer-domain] (string/split referer #"/")]
                  {:status 302 :headers {"Location" (str proto "//" referrer-domain)}
                   :session (assoc (req :session) :user-id id)

                       :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"] (config :site-url))
                      [proto _ referrer-domain] (string/split referer #"/")]
                  {:status 302 :headers {"Location" (str proto "//" referrer-domain)}
                   :session (assoc (req :session) :user-id id)
