                                  (make-verification-link req code email)))))
 
          ;; Create a session that contains the secret-key
-         (let [data (merge {:cylon/subject-identifier uid
-                            :name name}
+         (let [data (merge {:cylon/subject-identifier uid :name name}
                            (when (satisfies? OneTimePasswordStore user-store)
-                             {:totp-secret totp-secret})
-                           )]
+                             {:totp-secret totp-secret}))]
            (assoc-session-data! session-store req data)
-           (response (render-welcome
-                      renderer req
-                      (merge
-                       {:session (session session-store req)}
-                       form
-                       data))))))
+
+           (respond-with-new-session!
+            session-store req
+            {:cylon/subject-identifier uid}
+            (if-let [loc (or (get form "post_signup_redirect")
+                             (:post-signup-redirect component))]
+              (redirect-after-post loc)
+              (response (format "Thank you, %s, for signing up" name)))))))
 
      ::verify-user-email
      (fn [req]
        (let [params (-> req params-request :params)
              body
              (if-let [[email code] [ (get params "email") (get params "code")]]
-               (if-let [store (get-token-by-id (:verification-code-store this) code)]
+               (if-let [store (get-token-by-id (:verification-code-store component) code)]
                  (if (= email (:email store))
                    (do (verify-email! user-store (:name store))
                        (format "Thanks, Your email '%s'  has been verified correctly " email))


     })

  (routes [this]
    ["/" {"signup" {:get ::GET-signup-form
                    :post ::POST-signup-form}
          "verify-email" {:get ::verify-user-email}
          }])

  (uri-context [this] ""))

(defn new-signup-with-totp [& {:as opts}]
  (component/using

  {:fields [{:name s/Str
             :label s/Str
             (s/optional-key :placeholder) s/Str
             (s/optional-key :password?) s/Bool}]
   (s/optional-key :post-signup-redirect) s/Str})

(defrecord SignupWithTotp [renderer session-store user-store password-verifier verification-code-store emailer fields]
  Lifecycle
