diff --git a/src/clojars/friend/registration.clj b/src/clojars/friend/registration.clj index e4015911..cb4a25f4 100644 --- a/src/clojars/friend/registration.clj +++ b/src/clojars/friend/registration.clj @@ -12,7 +12,10 @@ :pgp-key pgp-key} (new-user-validations db confirm))] (-> - (response (register-form (apply concat (vals errors)) email username)) + (response (register-form {:errors (apply concat (vals errors)) + :email email + :username username + :pgp-key pgp-key})) (content-type "text/html")) (do (add-user db email username password pgp-key) (workflow/make-auth {:identity username :username username})))) diff --git a/src/clojars/routes/user.clj b/src/clojars/routes/user.clj index 8faee863..e3234eb0 100644 --- a/src/clojars/routes/user.clj +++ b/src/clojars/routes/user.clj @@ -18,8 +18,8 @@ (auth/with-account (view/update-profile db account params))) - (GET "/register" _ - (view/register-form)) + (GET "/register" {:keys [params]} + (view/register-form params)) (GET "/forgot-password" _ (view/forgot-password-form)) diff --git a/src/clojars/web/user.clj b/src/clojars/web/user.clj index c44dae35..413eee68 100644 --- a/src/clojars/web/user.clj +++ b/src/clojars/web/user.clj @@ -17,7 +17,7 @@ [valip.core :refer [validate]] [valip.predicates :as pred])) -(defn register-form [ & [errors email username pgp-key]] +(defn register-form [{:keys [errors email username pgp-key]}] (html-doc nil "Register" [:div.small-section [:h1 "Register"] @@ -29,7 +29,8 @@ :placeholder "bob@example.com"} :email) (label :username "Username") - (text-field {:required true + (text-field {:value username + :required true :placeholder "bob"} :username) (label :password "Password") diff --git a/test/clojars/test/integration/users.clj b/test/clojars/test/integration/users.clj index d85d1f5b..3291252c 100644 --- a/test/clojars/test/integration/users.clj +++ b/test/clojars/test/integration/users.clj @@ -41,6 +41,8 @@ (fill-in "Username" "dantheman") (press "Register") (has (status? 200)) + (has (value? [:input#username] "dantheman")) + (has (value? [:input#email] "test@example.com")) (within [:div.error :ul :li] (has (text? "Password and confirm password must match")))