This commit is contained in:
lizanle 2015-08-25 16:39:22 +08:00
parent 79bd438c87
commit c360bdaf7d
3 changed files with 14 additions and 5 deletions

View File

@ -25,7 +25,7 @@ class AccountController < ApplicationController
# Login request and validation
def login
if request.get?
@login = params[:login]
@login = params[:login] || true
if User.current.logged?
redirect_to home_url
else
@ -39,10 +39,10 @@ class AccountController < ApplicationController
# Log out current user and redirect to welcome page
def logout
if User.current.anonymous?
redirect_to home_url
redirect_to signin_path
elsif request.post?
logout_user
redirect_to home_url
redirect_to signin_path
end
# display the logout form
end

View File

@ -50,7 +50,9 @@
<ul class="topnav_login_list">
<li><a href="javascript:void(0);" class="menuGrey">修改资料</a> </li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li><a href="<%= signout_path %>" class="menuGrey" >退出</a></li>
<li>
<%= link_to "退出",signout_path,:class => "menuGrey",:method => "post"%>
</li>
</ul>
</li>
</ul>
@ -71,4 +73,11 @@
}).mouseout(function(){
$("#navHomepageSearchType").hide();
});
function signout(){
$.post(
'<%= signout_path%>',
{}
);
}
</script>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_public', 'user_leftside', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user"%>