Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added name to client and authorization page

  • Loading branch information...
commit a03c0bb463daf16a10622be163e0b65f67653c10 1 parent 7050823
Pelle Braendgaard authored
Showing with 12 additions and 9 deletions.
  1. +1 −1  src/clauth/demo.clj
  2. +11 −8 src/clauth/views.clj
2  src/clauth/demo.clj
View
@@ -92,7 +92,7 @@
:port 6379
:db 14
}
- (let [client ( or (first (clients)) (register-client))
+ (let [client ( or (first (clients)) (register-client "Clauth Demo" "http://pelle.github.com/clauth"))
user ( or (first (clauth.user/users)) (clauth.user/register-user "demo" "password"))]
(println "App starting up:")
(prn client)
19 src/clauth/views.clj
View
@@ -2,7 +2,8 @@
(:use [ring.util.response]
[clauth.middleware :only [csrf-token]]
[hiccup.core]
- [hiccup.form]))
+ [hiccup.form]
+ [clauth.client :only [fetch-client]]))
(defn csrf-field
"hidden form field containing csrf-token"
@@ -38,13 +39,15 @@
(defn authorization-form
([req]
- (html
- (form-to [:post (req :uri)]
- (csrf-field req)
- (include-hidden-params req ["client_id" "response_type" "redirect_uri" "scope" "state"])
- [:div {:class "form-actions"}
- [:button {:type "submit" :class "btn btn-primary"} "Authorize"]
- [:a {:class "btn" :href (or ((req :params) "redirect_uri") "/")} "Cancel"]]))))
+ (let [client (fetch-client ((req :params) :client_id))]
+ (html
+ (form-to [:post (req :uri)]
+ (csrf-field req)
+ (include-hidden-params req ["client_id" "response_type" "redirect_uri" "scope" "state"])
+ [:h2 (:name client) " requested authorization"]
+ [:div {:class "form-actions"}
+ [:button {:type "submit" :class "btn btn-primary"} "Authorize"]
+ [:a {:class "btn" :href (or ((req :params) "redirect_uri") "/")} "Cancel"]])))))
(defn authorization-form-handler
"Login form ring handler"
Please sign in to comment.
Something went wrong with that request. Please try again.