             (if-let [user-id (get-in req [:session :user-id])]
               (do
                 (join-group user-id group-id)
-                (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 #"/")]
                   {:status 302
                    :headers {"Location" (str proto "//" referrer-domain "/" group-id "/inbox")}

                                         :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))

                       :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)
