Merge pull request #1368 from Ma27/login-submit-btn

Use `submit` event in login form
This commit is contained in:
John Ericson 2024-03-26 11:23:51 -04:00 committed by GitHub
commit b676b08fac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -33,7 +33,7 @@
<div id="hydra-signin" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true"> <div id="hydra-signin" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<form> <form id="signin-form">
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group">
<label for="username" class="col-form-label">User name</label> <label for="username" class="col-form-label">User name</label>
@ -45,7 +45,7 @@
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button id="do-signin" type="button" class="btn btn-primary">Sign in</button> <button type="submit" class="btn btn-primary">Sign in</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div> </div>
</form> </form>
@ -57,10 +57,11 @@
function finishSignOut() { } function finishSignOut() { }
$("#do-signin").click(function() { $("#signin-form").submit(function(e) {
e.preventDefault();
requestJSON({ requestJSON({
url: "[% c.uri_for('/login') %]", url: "[% c.uri_for('/login') %]",
data: $(this).parents("form").serialize(), data: $(this).serialize(),
type: 'POST', type: 'POST',
success: function(data) { success: function(data) {
window.location.reload(); window.location.reload();