diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 913612f80..40a9fab63 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -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 diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 5cd2b915b..40b65f9f9 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -50,7 +50,9 @@ @@ -71,4 +73,11 @@ }).mouseout(function(){ $("#navHomepageSearchType").hide(); }); + + function signout(){ + $.post( + '<%= signout_path%>', + {} + ); + } diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index 0349caf13..3cd1fc25e 100644 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -7,7 +7,7 @@ <%= 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"%>