Skip to content
Browse files

Trim whitespace from pgp key if a pgp key is present

  • Loading branch information...
1 parent 9bf0073 commit 2b3d0f8e78790d0d0465ce3829d141a33fc5bf3d @dakrone committed Nov 17, 2012
Showing with 10 additions and 9 deletions.
  1. +10 −9 src/clojars/web/user.clj
View
19 src/clojars/web/user.clj
@@ -95,15 +95,16 @@
(submit-button "Update")))))
(defn update-profile [account {:keys [email password confirm ssh-key pgp-key]}]
- (if-let [errors (apply validate {:email email
- :username account
- :password password
- :ssh-key ssh-key
- :pgp-key pgp-key}
- (update-user-validations confirm))]
- (profile-form account (apply concat (vals errors)))
- (do (update-user account email account password ssh-key pgp-key)
- (redirect "/profile"))))
+ (let [pgp-key (and pgp-key (.trim pgp-key))]
+ (if-let [errors (apply validate {:email email
+ :username account
+ :password password
+ :ssh-key ssh-key
+ :pgp-key pgp-key}
+ (update-user-validations confirm))]
+ (profile-form account (apply concat (vals errors)))
+ (do (update-user account email account password ssh-key pgp-key)
+ (redirect "/profile")))))
(defn show-user [account user]
(html-doc account (h (user :user))

0 comments on commit 2b3d0f8

Please sign in to comment.
Something went wrong with that request. Please try again.