登录界面enter键监听
This commit is contained in:
parent
6d768100f8
commit
9437188c9b
|
@ -365,14 +365,15 @@ class AccountController < ApplicationController
|
|||
|
||||
def invalid_credentials
|
||||
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
flash.now[:error] = l(:notice_account_invalid_creditentials)
|
||||
render :layout => 'login'
|
||||
flash[:error] = l(:notice_account_invalid_creditentials)
|
||||
# render :layout => 'login'
|
||||
redirect_to signin_path(:login=>true)
|
||||
end
|
||||
|
||||
def invalid_credentials_new
|
||||
logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}"
|
||||
flash.now[:error] = l(:notice_account_invalid_creditentials_new)
|
||||
render :layout => 'login'
|
||||
flash[:error] = l(:notice_account_invalid_creditentials_new)
|
||||
render signin_path(:login=>true)
|
||||
end
|
||||
|
||||
# Register a user for email activation.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= stylesheet_link_tag 'new_user'%>
|
||||
<%= stylesheet_link_tag 'leftside'%>
|
||||
|
||||
<script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// $(document).ready(function(){
|
||||
// $("#loginSignButton").click(function(){
|
||||
|
@ -12,6 +12,20 @@
|
|||
// $("#signUpBox").css({display:"none"});
|
||||
// $("#loginInBox").css({display:"block"});
|
||||
// });
|
||||
// });
|
||||
// $(function(){
|
||||
// $("#username").keypress(function(e){
|
||||
// alert(11);
|
||||
// if (e.keyCode == '13') {
|
||||
// $('#main_login_form').submit();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// $("#password").keypress(function(e){
|
||||
// if (e.keyCode == '13') {
|
||||
// $('#main_login_form').submit();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
|
||||
$(document).ready(function(){
|
||||
|
@ -162,6 +176,12 @@
|
|||
|
||||
});
|
||||
});
|
||||
|
||||
function user_name_keypress(e){
|
||||
if (e.keyCode == '13') {
|
||||
$('#main_login_form').submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="loginContentContainer">
|
||||
<div class="loginContent">
|
||||
|
@ -186,7 +206,7 @@
|
|||
<%= back_url_hidden_field_tag %>
|
||||
<div class="mb20">
|
||||
<%= text_field_tag 'username', params[:username], :tabindex => '1' ,
|
||||
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称'%>
|
||||
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%>
|
||||
<!--<input type="text" placeholder="请输入邮箱地址或昵称" class="loginSignBox" />-->
|
||||
</div>
|
||||
<% if Setting.openid? %>
|
||||
|
@ -196,7 +216,7 @@
|
|||
<% end %>
|
||||
<div>
|
||||
<!--<input type="text" placeholder="请输密码" class="loginSignBox" />-->
|
||||
<%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码'%>
|
||||
<%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码', :onkeypress => "user_name_keypress(event);"%>
|
||||
</div>
|
||||
<div class="loginSignOption">
|
||||
<% if Setting.autologin? %>
|
||||
|
|
|
@ -16,16 +16,13 @@
|
|||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function() {
|
||||
$(document).keyup(function (e) {
|
||||
var e = e || event,
|
||||
code = e.which || e.keyCode;
|
||||
if (code == 13 && $("#loginInBox").css('display') == 'block') {
|
||||
e.preventDefault();
|
||||
$('#main_login_form').submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
function search_in_header(){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
$(this).parent().submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="navContainer">
|
||||
<% is_current_user = User.current.logged? && User.current == @user%>
|
||||
|
|
Loading…
Reference in New Issue