Skip to content

Commit

Permalink
注册页面禁用回车按钮 #268
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo committed Jun 23, 2019
1 parent dafafc2 commit f274515
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions common/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,33 @@ <h4 class="modal-title" id="myModalLabel">注册账号</h4>
</div>
<div class="modal-body">
<div class="form-group">
<input type="text" class="form-control" id="username" placeholder="用户名">
<input type="text" autocomplete="off"
class="form-control" id="username" placeholder="用户名">
</div>
<div class="form-group">
<input type="text" class="form-control" id="display" placeholder="中文名">
<input type="text" autocomplete="off"
class="form-control" id="display" placeholder="中文名">
</div>
<div class="form-group">
<input type="text" class="form-control" id="email" placeholder="邮箱">
<input type="text" autocomplete="off"
class="form-control" id="email" placeholder="邮箱">
</div>
<div class="form-group">
<input type="password" class="form-control" id="password" placeholder="密码">
<input type="password"
class="form-control" id="password" placeholder="密码">
</div>
<div class="form-group">
<input type="password" class="form-control" id="password2" placeholder="密码确认">
<input type="password"
class="form-control" autocomplete="new-password" id="password2"
placeholder="密码确认">
</div>

<div class="form-group">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button id="btnSign" type="submit" class="btn btn-success">确认提交</button>
<button id="btnSign" type="submit" class="btn btn-success">注册</button>
</div>
</div>
</div>
Expand Down Expand Up @@ -142,11 +148,12 @@ <h4 class="modal-title" id="myModalLabel">
$(document).ready(function () {
$(document).keydown(function (event) {
//keycode==13为回车键
if (event.keyCode == 13) {
console.log($("#sign-up").css("display"))
if (event.keyCode === 13 && $("#sign-up").css("display") === 'none') {
$('#btnLogin').addClass('disabled');
$('#btnLogin').prop('disabled', true);
username = $('#inputUsername').val();
password = $('#inputPassword').val();
let username = $('#inputUsername').val();
let password = $('#inputPassword').val();
authenticateUser(username, password);
}
});
Expand Down
2 changes: 1 addition & 1 deletion sql/templates/data_dictionary.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</table>

<div class="modal fade" id="showModal">
<div class="modal-dialog" style="width:70%;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span
Expand Down

0 comments on commit f274515

Please sign in to comment.