mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
Refactor sessions
This commit is contained in:
parent
e2507f8661
commit
744f29c674
18 changed files with 126 additions and 16 deletions
10
app/controllers/admin/sessions_controller.rb
Normal file
10
app/controllers/admin/sessions_controller.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class Admin::SessionsController < SessionsController
|
||||
layout 'login'
|
||||
|
||||
def create
|
||||
super
|
||||
end
|
||||
|
||||
def login
|
||||
end
|
||||
end
|
|
@ -17,9 +17,14 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def after_sign_in_path_for(_resource)
|
||||
if session[:user_return_to] && session[:user_return_to] != login_path
|
||||
return session[:user_return_to].to_s
|
||||
return session[:user_return_to].to_s
|
||||
end
|
||||
|
||||
if request.path.match('registrar')
|
||||
registrar_invoices_path
|
||||
elsif request.path.match('admin')
|
||||
admin_dashboard_path
|
||||
end
|
||||
admin_dashboard_path
|
||||
end
|
||||
|
||||
def user_for_paper_trail
|
||||
|
|
7
app/controllers/registrar/invoices_controller.rb
Normal file
7
app/controllers/registrar/invoices_controller.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Registrar::InvoicesController < RegistrarController
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
|
||||
end
|
||||
end
|
7
app/controllers/registrar/sessions_controller.rb
Normal file
7
app/controllers/registrar/sessions_controller.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Registrar::SessionsController < SessionsController
|
||||
layout 'registrar'
|
||||
|
||||
def login
|
||||
|
||||
end
|
||||
end
|
4
app/controllers/registrar_controller.rb
Normal file
4
app/controllers/registrar_controller.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class RegistrarController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
layout 'registrar'
|
||||
end
|
|
@ -14,8 +14,4 @@ class SessionsController < Devise::SessionsController
|
|||
sign_in_and_redirect @user, event: :authentication
|
||||
# end
|
||||
end
|
||||
|
||||
def login
|
||||
render 'layouts/login', layout: false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue