Changed from textarea to text field, added issuer
This commit is contained in:
parent
30ddfd295c
commit
8def2ec408
2 changed files with 27 additions and 10 deletions
|
@ -13,9 +13,10 @@
|
|||
<div class="container jumbotron">
|
||||
<form class="needs-validation" id="form">
|
||||
<label for="config" class="form-label">Your fqdn:</label>
|
||||
<textarea name="fqdn" id="fqdn" class="form-control" rows="1">
|
||||
your.domain.com
|
||||
</textarea>
|
||||
<input class="form-control" type="text" name="fqdn" id="fqdn" value="your.domain.com">
|
||||
<br>
|
||||
<label for="config" class="form-label">(Optional) Your issuer prod/staging:</label>
|
||||
<input class="form-control" type="text" name="issuer" id="issuer" value="">
|
||||
<div class="invalid-feedback"><pre id="config-validation"></pre></div>
|
||||
<br><br>
|
||||
|
||||
|
|
|
@ -13,6 +13,17 @@
|
|||
(-> js/document
|
||||
(.getElementById "fqdn")))
|
||||
|
||||
(defn issuer []
|
||||
(-> js/document
|
||||
(.getElementById "issuer")))
|
||||
|
||||
(defn issuer-from-document []
|
||||
(let [issuer-str (-> (issuer)
|
||||
(.-value))]
|
||||
(if (= issuer-str "")
|
||||
:staging
|
||||
(keyword issuer-str))))
|
||||
|
||||
(defn auth []
|
||||
(-> js/document
|
||||
(.getElementById "auth")))
|
||||
|
@ -22,9 +33,9 @@
|
|||
(.getElementById "form")))
|
||||
|
||||
(defn config-from-document []
|
||||
{:fqdn
|
||||
(-> (fqdn)
|
||||
(.-value))})
|
||||
{:fqdn (-> (fqdn)
|
||||
(.-value))
|
||||
:issuer (issuer-from-document)})
|
||||
|
||||
(defn auth-from-document []
|
||||
(-> (auth)
|
||||
|
@ -45,11 +56,12 @@
|
|||
(set! validation-result))
|
||||
(-> (fqdn)
|
||||
(.setCustomValidity validation-result))
|
||||
(-> (issuer)
|
||||
(.setCustomValidity validation-result))
|
||||
validation-result)
|
||||
|
||||
(defn validate-config! []
|
||||
(let [config-str (config-from-document)
|
||||
config-map (edn/read-string config-str)]
|
||||
(let [config-map (config-from-document)]
|
||||
(if (s/valid? core/config? config-map)
|
||||
(set-config-validation-result! "")
|
||||
(set-config-validation-result!
|
||||
|
@ -73,7 +85,6 @@
|
|||
(defn validate-auth! []
|
||||
(let [auth-str (auth-from-document)
|
||||
auth-map (edn/read-string auth-str)]
|
||||
(print-debug (s/valid? core/auth? auth-map))
|
||||
(if (s/valid? core/auth? auth-map)
|
||||
(set-auth-validation-result! "")
|
||||
(set-auth-validation-result!
|
||||
|
@ -97,4 +108,9 @@
|
|||
(.addEventListener "blur"
|
||||
#(do (validate-config!)
|
||||
(validate-auth!)
|
||||
(set-validated!)))))
|
||||
(set-validated!))))
|
||||
(-> (issuer)
|
||||
(.addEventListener "blur"
|
||||
#(do (validate-config!)
|
||||
(validate-auth!)
|
||||
(set-validated!)))))
|
Loading…
Reference in a new issue