File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed
Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 108108 (.after (db/get-time ) expires_at)))
109109
110110(defn token-credential-fn [db]
111- (fn [{:keys [ username password] }]
111+ (fn [{username-or-email : username password :password }]
112112 (log/with-context {:tag :authentication
113- :username username
113+ :username username-or-email
114114 :type :token }
115115 (let [password-hash (when password
116- (db/hash-deploy-token password))]
117- (if-let [token (and password
116+ (db/hash-deploy-token password))
117+ username (:user (db/find-user-by-user-or-email db username-or-email))]
118+ (if-let [token (and username
119+ password
118120 (->> (db/find-user-tokens-by-username db username)
119121 (remove :disabled )
120122 (filter #(let [{:keys [token_hash]} %]
Original file line number Diff line number Diff line change 4040 help/test-port))
4141
4242(defn deploy
43- [{:keys [artifact-map coordinates jar-file password pom-file transfer-listener]
44- :or {transfer-listener (fn [])}}]
43+ [{:keys [artifact-map coordinates jar-file password pom-file transfer-listener username]
44+ :or {transfer-listener (fn [])
45+ username " dantheman" }}]
4546 ; ; HttpWagon uses a static, inaccessible http client that caches cookies, so
4647 ; ; we have to clear sessions on each deploy to mimic having new prucesses
4748 ; ; deploying.
5253 :jar-file jar-file
5354 :pom-file pom-file
5455 :repository {" test" {:url (repo-url )
55- :username " dantheman "
56+ :username username
5657 :password password}}
5758 :local-repo help/local-repo
5859 :transfer-listener transfer-listener))
124125 (within [:td.last-used ]
125126 (has (text? (common/format-timestamp now)))))))
126127
128+ (deftest user-can-deploy-using-email-address
129+ (-> (session (help/app-from-system ))
130+ (register-as " dantheman" " test@example.org" " password" ))
131+ (let [token (create-deploy-token (session (help/app-from-system )) " dantheman" " password" " testing" )]
132+ (deploy
133+ {:coordinates '[org.clojars.dantheman/test " 0.0.1" ]
134+ :jar-file (io/file (io/resource " test.jar" ))
135+ :pom-file (help/rewrite-pom (io/file (io/resource " test-0.0.1/test.pom" ))
136+ {:groupId " org.clojars.dantheman" })
137+ :username " test@example.org"
138+ :password token})))
139+
127140(deftest deploying-with-a-scoped-token
128141 (-> (session (help/app-from-system ))
129142 (register-as " dantheman" " test@example.org" " password" ))
You can’t perform that action at this time.
0 commit comments