• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / e98ae4b5-e123-4c92-ac1a-3395947ae8fe

20 May 2026 10:23PM UTC coverage: 82.236% (-13.3%) from 95.582%
e98ae4b5-e123-4c92-ac1a-3395947ae8fe

push

circleci

web-flow
Add cooldown to dependabot (#5915)

This matches the other DACS projects

5472 of 6654 relevant lines covered (82.24%)

1134.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.45
/app/controllers/application_controller.rb
1
# frozen_string_literal: true
2

3
class ApplicationController < ActionController::Base
1✔
4
  # Adds a few additional behaviors into the application controller
5
  include Blacklight::Controller
1✔
6

7
  # Please be sure to impelement current_user and user_session. Blacklight depends on
8
  # these methods in order to perform user specific actions.
9

10
  layout 'application'
1✔
11

12
  # Prevent CSRF attacks by raising an exception.
13
  # For APIs, you may want to use :null_session instead.
14
  protect_from_forgery with: :exception
1✔
15

16
  def after_sign_in_path_for(resource)
1✔
17
    stored_location = stored_location_for(resource)
1✔
18
    if referrer.present? && referrer.exclude?("sign_in") && !origin&.include?("redirect-to-alma")
1✔
19
      referrer
×
20
    elsif origin.present?
1✔
21
      request.flash.delete('alert')
1✔
22
      request.flash.keep('notice')
1✔
23
      origin.chomp('/email')
1✔
24
    elsif !request.env['omniauth.origin'].nil? &&
×
25
          /request|borrow-direct|email|bookmarks|search_history|redirect-to-alma/.match(request.env['omniauth.origin'])
26
      referrer_from_url(request.env['omniauth.origin'])
×
27
    elsif stored_location.present?
×
28
      stored_location
×
29
    else
30
      account_path
×
31
    end
32
  end
33

34
  def referrer
1✔
35
    @referrer ||= params[:url] || request.referer
8✔
36
  end
37

38
  def origin
1✔
39
    @origin ||= begin
2✔
40
      return params[:origin] if params[:origin].present?
2✔
41

42
      if referrer.present? && referrer.include?("origin")
2✔
43
        referrer_params = Rack::Utils.parse_query URI.parse(referrer).query
2✔
44
        return referrer_params["origin"]
2✔
45
      end
46
    end
47
  end
48

49
  def after_sign_out_path_for(resource)
1✔
50
    if resource == 'barcode' || resource == "alma"
×
51
      root_url
×
52
    else
53
      Rails.configuration.x.after_sign_out_url
×
54
    end
55
  end
56

57
  def default_url_options
1✔
58
    Rails.env.production? || Rails.env.staging? ? { protocol: 'https' } : {}
596✔
59
  end
60

61
  def render_bookmarks?
1✔
62
    controller_path == 'bookmarks'
66✔
63
  end
64

65
  private
1✔
66

67
    def verify_admin!
1✔
68
      authenticate_user!
3✔
69
      head :forbidden unless current_user.admin?
2✔
70
    end
71

72
    def referrer_from_url(url)
1✔
73
      query = URI.parse(url).query
×
74
      if query
×
75
        CGI.parse(query).try(:[], "referer")&.first
×
76
      else
77
        url
×
78
      end
79
    end
80

81
    before_action do
1✔
82
      Rack::MiniProfiler.authorize_request if current_user&.admin?
120✔
83
    end
84
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc