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

pulibrary / orangelight / 25bfe78f-c539-4492-9179-151d22460b61

30 Aug 2024 08:17PM UTC coverage: 45.357% (-50.4%) from 95.758%
25bfe78f-c539-4492-9179-151d22460b61

push

circleci

web-flow
Merge pull request #4168 from pulibrary/left_anchor_iii

Left anchor search

23 of 23 new or added lines in 1 file covered. (100.0%)

3090 existing lines in 140 files now uncovered.

2779 of 6127 relevant lines covered (45.36%)

7.28 hits per line

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

36.36
/app/controllers/users/omniauth_callbacks_controller.rb
1
# frozen_string_literal: true
2

3
module Users
2✔
4
  class OmniauthCallbacksController < Devise::OmniauthCallbacksController
2✔
5
    def cas
2✔
UNCOV
6
      @user = User.from_cas access_token_in_request_params
×
7

UNCOV
8
      sign_in_and_redirect @user, event: :authentication # this will throw if @user is not activated
×
UNCOV
9
      if is_navigational_format?
×
UNCOV
10
        set_flash_message(:notice, :success, kind: 'from Princeton Central Authentication '\
×
11
                                                   'Service')
12
      end
13
    end
14

15
    def alma
2✔
UNCOV
16
      if Alma::User.authenticate(user_id: ERB::Util.url_encode(alma_params[:username]), password: alma_params[:password])
×
UNCOV
17
        @user ||= User.from_alma(access_token_in_request_params)
×
UNCOV
18
        @user.save
×
UNCOV
19
        sign_in_and_redirect @user, event: :authentication # this will throw if @user not activated
×
UNCOV
20
        set_flash_message(:notice, :success, kind: 'with alma account') if is_navigational_format?
×
21
      else
UNCOV
22
        set_flash_message(:error, :failure,
×
23
          reason: 'username or password did not match an alma account')
UNCOV
24
        redirect_to user_alma_omniauth_authorize_path(origin: omniauth_origin)
×
25
      end
26
    end
27

28
    private
2✔
29

30
      def omniauth_origin
2✔
UNCOV
31
        request.env['omniauth.origin']
×
32
      end
33

34
      # Accesses the access token passed within the request headers
35
      # @return [OmniAuth::AuthHash,nil] the access token
36
      def access_token_in_request_params
2✔
UNCOV
37
        request.env['omniauth.auth']
×
38
      end
39

40
      def alma_params
2✔
UNCOV
41
        params.permit(:username, :password)
×
42
      end
43
  end
44
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