mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 04:11:41 +00:00
Merge branch 'issue-15188' into 'rails'
feat: recordar la ubicación #15188 See merge request sutty/sutty!256
This commit is contained in:
commit
73166355a7
1 changed files with 12 additions and 1 deletions
|
@ -11,6 +11,7 @@ class ApplicationController < ActionController::Base
|
|||
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||
before_action :notify_unconfirmed_email, unless: :devise_controller?
|
||||
around_action :set_locale
|
||||
after_action :store_location!
|
||||
|
||||
rescue_from Pundit::NilPolicyError, with: :page_not_found
|
||||
rescue_from ActionController::RoutingError, with: :page_not_found
|
||||
|
@ -115,6 +116,16 @@ class ApplicationController < ActionController::Base
|
|||
def after_sign_in_path_for(resource)
|
||||
session[:locale] = nil
|
||||
|
||||
sites_path
|
||||
super
|
||||
end
|
||||
|
||||
# Guardar la ubicación para que devise redirija a donde íbamos, a
|
||||
# menos que estemos recibiendo información o intentando ingresar.
|
||||
def store_location!
|
||||
return if request.xhr?
|
||||
return unless request.request_method_symbol == :GET
|
||||
return if devise_controller? && !is_a?(Devise::RegistrationsController) && params[:action] != 'edit'
|
||||
|
||||
session[:usuarie_return_to] = request.fullpath
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue