lib/passwd/rails/action_controller_ext.rb in passwd-0.3.0 vs lib/passwd/rails/action_controller_ext.rb in passwd-0.4.0

- old
+ new

@@ -31,19 +31,20 @@ session[_auth_key] = nil @current_user = nil end def redirect_to_referer_or(path, options = {}) - redirect_to session[:referer].presence || path, **options + redirect_to session[:signin_referer].presence || path, **options end def require_signin - unless signin? - path = _signin_path - raise UnauthorizedAccess unless path - session[:referer] = request.fullpath - redirect_to path - end + return if signin? + + path = _signin_path + raise UnauthorizedAccess unless path + + session[:signin_referer] = request.fullpath + redirect_to path end def passwd_auth_class nil end