mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Redirect to correct path after logout
This commit is contained in:
parent
f34bca591e
commit
0ecbd87004
4 changed files with 13 additions and 7 deletions
|
@ -16,7 +16,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def after_sign_in_path_for(_resource)
|
||||
if session[:user_return_to] && session[:user_return_to] != login_path
|
||||
if session[:user_return_to]
|
||||
return session[:user_return_to].to_s
|
||||
end
|
||||
|
||||
|
@ -27,6 +27,14 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
end
|
||||
|
||||
def after_sign_out_path_for(_resource)
|
||||
if request.path.match('registrar')
|
||||
registrar_login_path
|
||||
elsif request.path.match('admin')
|
||||
admin_login_path
|
||||
end
|
||||
end
|
||||
|
||||
def user_for_paper_trail
|
||||
if defined?(current_user) && current_user.present?
|
||||
# Most of the time it's not loaded in correct time because PaperTrail before filter kicks in
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
%li= link_to t(:api_users), admin_api_users_path
|
||||
|
||||
%ul.nav.navbar-nav.navbar-right
|
||||
%li= link_to t('log_out', user: current_user), '/logout'
|
||||
%li= link_to t('log_out', user: current_user), '/admin/logout'
|
||||
|
||||
/ /.nav-collapse
|
||||
.container
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
- if can? :show, Invoice
|
||||
%li= link_to t('invoices'), registrar_invoices_path
|
||||
%ul.nav.navbar-nav.navbar-right
|
||||
%li= link_to t('log_out', user: current_user), '/logout'
|
||||
%li= link_to t('log_out', user: current_user), '/registrar/logout'
|
||||
|
||||
/ /.nav-collapse
|
||||
.container
|
||||
|
|
|
@ -68,6 +68,7 @@ Rails.application.routes.draw do
|
|||
devise_scope :user do
|
||||
get 'login' => 'sessions#login'
|
||||
post 'sessions' => 'sessions#create'
|
||||
get 'logout' => '/devise/sessions#destroy'
|
||||
end
|
||||
|
||||
root 'domains#index'
|
||||
|
@ -79,6 +80,7 @@ Rails.application.routes.draw do
|
|||
devise_scope :user do
|
||||
get 'login' => 'sessions#login'
|
||||
post 'sessions' => 'sessions#create'
|
||||
get 'logout' => '/devise/sessions#destroy'
|
||||
end
|
||||
|
||||
# authenticated :user do
|
||||
|
@ -90,10 +92,6 @@ Rails.application.routes.draw do
|
|||
|
||||
devise_for :users
|
||||
|
||||
devise_scope :user do
|
||||
get 'logout' => 'devise/sessions#destroy'
|
||||
end
|
||||
|
||||
# authenticated :user do
|
||||
# root to: 'admin/domains#index', as: :authenticated_root
|
||||
# end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue