DEV: Migrate Github authentication to ManagedAuthenticator (#11170)

This commit adds an additional find_user_by_email hook to ManagedAuthenticator so that GitHub login can continue to support secondary email addresses

The github_user_infos table will be dropped in a follow-up commit.

This is the last core authenticator to be migrated to ManagedAuthenticator 🎉
This commit is contained in:
David Taylor
2020-11-10 10:09:15 +00:00
committed by GitHub
parent 586c8efbd8
commit cf21de0e7a
13 changed files with 86 additions and 209 deletions

View File

@@ -1,22 +0,0 @@
# frozen_string_literal: true
class GithubUserInfo < ActiveRecord::Base
belongs_to :user
end
# == Schema Information
#
# Table name: github_user_infos
#
# id :integer not null, primary key
# user_id :integer not null
# screen_name :string not null
# github_user_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_github_user_infos_on_github_user_id (github_user_id) UNIQUE
# index_github_user_infos_on_user_id (user_id) UNIQUE
#

View File

@@ -40,7 +40,6 @@ class User < ActiveRecord::Base
has_one :user_option, dependent: :destroy
has_one :user_avatar, dependent: :destroy
has_one :github_user_info, dependent: :destroy
has_one :primary_email, -> { where(primary: true) }, class_name: 'UserEmail', dependent: :destroy
has_one :user_stat, dependent: :destroy
has_one :user_profile, dependent: :destroy, inverse_of: :user

View File

@@ -60,7 +60,6 @@ class UserAnonymizer
end
@user.user_avatar.try(:destroy)
@user.github_user_info.try(:destroy)
@user.single_sign_on_record.try(:destroy)
@user.oauth2_user_infos.try(:destroy_all)
@user.user_associated_accounts.try(:destroy_all)