allow enter keypress to submit login form
This commit is contained in:
parent
89112fb19e
commit
c471840fd7
|
@ -27,7 +27,10 @@
|
||||||
:on-error #(reset! error "Invalid username/password.")
|
:on-error #(reset! error "Invalid username/password.")
|
||||||
:on-success (fn [_]
|
:on-success (fn [_]
|
||||||
(on-close)
|
(on-close)
|
||||||
(views/reconnect!))))))]
|
(views/reconnect!))))))
|
||||||
|
on-key-up (fn [e]
|
||||||
|
(if (= 13 (.-keyCode e))
|
||||||
|
(on-submit)))]
|
||||||
(fn []
|
(fn []
|
||||||
[bs/Modal
|
[bs/Modal
|
||||||
{:show (boolean @auth/show-login)
|
{:show (boolean @auth/show-login)
|
||||||
|
@ -43,14 +46,16 @@
|
||||||
[bs/FormControl
|
[bs/FormControl
|
||||||
{:type "text"
|
{:type "text"
|
||||||
:value (or (:username @values) "")
|
:value (or (:username @values) "")
|
||||||
:on-change #(swap! values assoc :username (get-field-value %))}]]]
|
:on-change #(swap! values assoc :username (get-field-value %))
|
||||||
|
:on-key-up on-key-up}]]]
|
||||||
[bs/FormGroup
|
[bs/FormGroup
|
||||||
[bs/Col {:class "text-right" :sm 4} [bs/ControlLabel "Password"]]
|
[bs/Col {:class "text-right" :sm 4} [bs/ControlLabel "Password"]]
|
||||||
[bs/Col {:sm 6}
|
[bs/Col {:sm 6}
|
||||||
[bs/FormControl
|
[bs/FormControl
|
||||||
{:type "password"
|
{:type "password"
|
||||||
:value (or (:password @values) "")
|
:value (or (:password @values) "")
|
||||||
:on-change #(swap! values assoc :password (get-field-value %))}]]]]]
|
:on-change #(swap! values assoc :password (get-field-value %))
|
||||||
|
:on-key-up on-key-up}]]]]]
|
||||||
[bs/Modal.Footer
|
[bs/Modal.Footer
|
||||||
[bs/Button {:bsStyle "primary" :on-click on-submit} "Login"]
|
[bs/Button {:bsStyle "primary" :on-click on-submit} "Login"]
|
||||||
[bs/Button {:on-click on-close} "Cancel"]]])))
|
[bs/Button {:on-click on-close} "Cancel"]]])))
|
Loading…
Reference in a new issue