                                      :else
                                      (swap! state assoc :user-status :error))))
              (swap! state assoc :user-status :not-logged-in))))))
+   :authenticate-with-fresh-token
+   (fn [{:keys [this state]} token]
+     (attempt-auth token (fn [{:keys [success? status-code]}]
+                           (cond
+                             (= 401 status-code)
+                             (swap! state assoc :user-status :auth-failure)
+                             (= 403 status-code)
+                             (do (utils/set-access-token-cookie token)
+                               (swap! state assoc :user-status :not-activated))
+                             ;; 404 just means not registered
+                             (or success? (= status-code 404))
+                             (do (utils/set-access-token-cookie token)
+                               (react/call :handle-successful-auth this token))
+                             :else
+                             (swap! state assoc :user-status :error)))))
    :handle-successful-auth
    (fn [{:keys [this state locals]} token]
      (reset! utils/access-token token)

      [:div {}
       [comps/Button
        {:text "Sign In"
         :href (str (config/api-url-root) "/login?callback="
                    (js/encodeURIComponent
                     (str js/window.location.protocol "//" js/window.location.hostname))
                    (let [hash (nav/get-hash-value)]
                      (if (clojure.string/blank? hash) "" (str "&path=" hash))))}]]
      [:div {:style {:marginTop "1em"}} [RegisterLink]]
      [:div {:style {:maxWidth 600 :paddingTop "2em" :fontSize "small"}}
        [Policy]]])})


(defn- server-unavailable-dialog [dismiss]

          (= :logged-in (:user-status @state))
          [LoggedIn {:nav-context (:root-nav-context @state)}]
          (= :not-logged-in (:user-status @state))
          [LoggedOut {:on-login #(react/call :authenticate-with-fresh-token this %)}])]]
      (footer)])
   :component-did-mount
   (fn [{:keys [this state]}]
