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

uclibs / ucrate / 19318464-2daa-466a-8837-eefd98aa6940

20 Jun 2025 04:33PM UTC coverage: 69.069% (+7.7%) from 61.334%
19318464-2daa-466a-8837-eefd98aa6940

push

circleci

web-flow
Update mysql to 0.5.3 for local deploy (#1180)

* Update mysql to 0.5.3 for local deployment

* Add mysql12 build fix to README

2568 of 3718 relevant lines covered (69.07%)

115.71 hits per line

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

0.0
/app/controllers/callbacks_controller.rb
1
# frozen_string_literal: true
2

3
class CallbacksController < Devise::OmniauthCallbacksController
×
4
  def orcid
×
5
    omni = request.env["omniauth.auth"]
×
6
    Devise::MultiAuth.capture_successful_external_authentication(current_user, omni)
×
7
    redirect_to root_path, notice: "You have successfully connected with your ORCID record"
×
8
  end
×
9

10
  def shibboleth
×
11
    if current_user
×
12
      redirect_to Hyrax::Engine.routes.url_helpers.dashboard_path
×
13
    else
×
14
      retrieve_shibboleth_attributes
×
15
      create_or_update_user
×
16
      sign_in_shibboleth_user
×
17
    end
×
18
  end
×
19

20
  private
×
21

22
  def retrieve_shibboleth_attributes
×
23
    @omni = request.env["omniauth.auth"]
×
24
    @email = use_uid_if_email_is_blank
×
25
  end
×
26

27
  def create_or_update_user
×
28
    unless user_exists?
×
29
      create_user
×
30
      send_welcome_email
×
31
    end
×
32
    update_user_shibboleth_attributes if user_has_never_logged_in?
×
33
    update_user_shibboleth_perishable_attributes
×
34
  end
×
35

36
  def sign_in_shibboleth_user
×
37
    sign_in_and_redirect @user, event: :authentication # this will throw if @user is not activated
×
38
    cookies[:login_type] = {
×
39
      value: "shibboleth",
×
40
      secure: Rails.env.production?
×
41
    }
×
42
    flash[:notice] = "You are now signed in as #{@user.name} (#{@user.email})"
×
43
  end
×
44

45
  def use_uid_if_email_is_blank
×
46
    # If user has no email address use their sixplus2@uc.edu instead
47
    # Some test accounts on QA/dev don't have email addresses
48
    return @omni.extra.raw_info.mail if defined?(@omni.extra.raw_info.mail) && @omni.extra.raw_info.mail.present?
×
49
    @omni.uid
×
50
  end
×
51

52
  def user_exists?
×
53
    @user = User.where(provider: @omni['provider'], uid: @omni['uid']).first
×
54
  end
×
55

56
  def user_has_never_logged_in?
×
57
    @user.sign_in_count.zero?
×
58
  end
×
59

60
  def create_user
×
61
    @user = User.create provider: @omni.provider,
×
62
                        uid: @omni.uid,
×
63
                        email: @email,
×
64
                        password: Devise.friendly_token[0, 20],
×
65
                        profile_update_not_required: false
×
66
  end
×
67

68
  def update_user_shibboleth_attributes
×
69
    @user.title              = @omni.extra.raw_info.title
×
70
    @user.telephone          = @omni.extra.raw_info.telephoneNumber
×
71
    @user.first_name         = @omni.extra.raw_info.givenName
×
72
    @user.last_name          = @omni.extra.raw_info.sn
×
73
    @user.save
×
74
  end
×
75

76
  def update_user_shibboleth_perishable_attributes
×
77
    @user.uc_affiliation     = @omni.extra.raw_info.uceduPrimaryAffiliation
×
78
    @user.ucdepartment       = @omni.extra.raw_info.ou
×
79
    @user.save
×
80
  end
×
81

82
  def send_welcome_email
×
83
    WelcomeMailer.welcome_email(@user).deliver
×
84
  end
×
85
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