diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 93248a73e..4b15beeab 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -109,7 +109,7 @@ def logout! helper_method :redirect_path def redirect_path - '/auth/github' + '/auth/codebar' end def authenticate_admin! diff --git a/app/controllers/auth_services_controller.rb b/app/controllers/auth_services_controller.rb index 2edb88b6e..ad7600918 100644 --- a/app/controllers/auth_services_controller.rb +++ b/app/controllers/auth_services_controller.rb @@ -4,7 +4,7 @@ def new if Rails.application.routes.recognize_path(referer_path)[:controller].in?(%w[workshops events meetings]) session[:referer_path] = referer_path end - redirect_to '/auth/github' + redirect_to '/auth/codebar' end def create diff --git a/app/controllers/terms_and_conditions_controller.rb b/app/controllers/terms_and_conditions_controller.rb index f88f3bf47..a0d3be421 100644 --- a/app/controllers/terms_and_conditions_controller.rb +++ b/app/controllers/terms_and_conditions_controller.rb @@ -13,7 +13,7 @@ def update # The show action skips accept_terms, but unauthenticated users can still # POST directly to update. Redirect to login to avoid NoMethodError on nil. unless logged_in? - redirect_to '/auth/github' + redirect_to '/auth/codebar' return end diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 4bd7e0b74..b24dcefff 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -43,7 +43,7 @@ Job Board - if !logged_in? %li.nav-item - = link_to '/auth/github', class: 'nav-link border-0' do + = link_to redirect_path, class: 'nav-link border-0' do Sign in - else - if current_user.is_admin? || current_user.organiser? || current_user.monthlies_organiser? diff --git a/app/views/terms_and_conditions/show.html.haml b/app/views/terms_and_conditions/show.html.haml index 6f1c3e03a..7a097f74f 100644 --- a/app/views/terms_and_conditions/show.html.haml +++ b/app/views/terms_and_conditions/show.html.haml @@ -15,7 +15,7 @@ %p = t('terms_and_conditions.login_required_html') %br - = link_to t('terms_and_conditions.login_link_text'), '/auth/github' + = link_to t('terms_and_conditions.login_link_text'), redirect_path - if logged_in? && !current_user.accepted_toc_at? = simple_form_for @terms_and_conditions_form, url: terms_and_conditions_path, method: :patch do |f| diff --git a/config/locales/en.yml b/config/locales/en.yml index a40f43709..673483c5b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -202,7 +202,7 @@ en: not_logged_in: "You must be logged in to access this page." signing_up: "Thanks for signing up. Please fill in your details to complete the registration process." authentication_error: "Authentication failed. Please try again." - email_missing_from_provider: "We could not retrieve your email address from GitHub. Please make sure your GitHub account has a public email address and try again." + email_missing_from_provider: "We could not retrieve your email address. Please make sure your account has a public email address and try again." navigation: dashboard: "Dashboard" code_of_conduct: "Code of Conduct" @@ -361,7 +361,7 @@ en: accept: "Accept" already_accepted_html: "You have already accepted our Code of Conduct on %{date}." login_required_html: "Please log in to accept our Code of Conduct." - login_link_text: "Log in with GitHub" + login_link_text: "Log in with codebar" messages: notice: "You have to accept the Terms and Conditions before you are able to proceed." footer: diff --git a/spec/controllers/auth_services_controller_spec.rb b/spec/controllers/auth_services_controller_spec.rb index 6e76484f6..93dadae5f 100644 --- a/spec/controllers/auth_services_controller_spec.rb +++ b/spec/controllers/auth_services_controller_spec.rb @@ -5,7 +5,7 @@ request.env["HTTP_REFERER"] = expected_referer_path get :new - expect(response).to redirect_to("/auth/github") + expect(response).to redirect_to("/auth/codebar") expect(session[:referer_path]).to eq(expected_referer_path) end @@ -14,7 +14,7 @@ request.env["HTTP_REFERER"] = expected_referer_path get :new - expect(response).to redirect_to("/auth/github") + expect(response).to redirect_to("/auth/codebar") expect(session[:referer_path]).to eq(expected_referer_path) end end diff --git a/spec/fabricators/auth_service_fabricator.rb b/spec/fabricators/auth_service_fabricator.rb index 3795f6964..4becdfe9a 100644 --- a/spec/fabricators/auth_service_fabricator.rb +++ b/spec/fabricators/auth_service_fabricator.rb @@ -1,4 +1,4 @@ Fabricator(:auth_service) do - provider { Faker::Company.name } + provider 'codebar' uid { Fabricate.sequence(:uid) { |n| "sq#{n}" } } end diff --git a/spec/features/accepting_terms_and_conditions_spec.rb b/spec/features/accepting_terms_and_conditions_spec.rb index 2b24f022c..98a0df80b 100644 --- a/spec/features/accepting_terms_and_conditions_spec.rb +++ b/spec/features/accepting_terms_and_conditions_spec.rb @@ -1,7 +1,7 @@ RSpec.feature 'Accepting Terms and Conditions', type: :feature do context 'When a user signs up to codebar' do before do - mock_github_auth + mock_codebar_auth end scenario "they can't proceed unless they accept the ToCs" do @@ -85,7 +85,7 @@ visit terms_and_conditions_path expect(page).to have_content('Please log in to accept our Code of Conduct.') - expect(page).to have_link('Log in with GitHub') + expect(page).to have_link('Log in with codebar') end scenario 'they see a disabled form' do diff --git a/spec/features/member/login_spec.rb b/spec/features/member/login_spec.rb index b16877287..53104faaf 100644 --- a/spec/features/member/login_spec.rb +++ b/spec/features/member/login_spec.rb @@ -3,7 +3,7 @@ describe 'Sign up' do describe 'when not all required details are set' do - it 'handles the registration when a user does not have a name set on github' do + it 'handles the registration when a user does not have a name set' do mock_auth_hash(name: nil) visit root_path diff --git a/spec/features/member_joining_spec.rb b/spec/features/member_joining_spec.rb index bf844bae7..4f6a03ed7 100644 --- a/spec/features/member_joining_spec.rb +++ b/spec/features/member_joining_spec.rb @@ -1,6 +1,6 @@ RSpec.feature 'A new student signs up', type: :feature do before do - mock_github_auth + mock_codebar_auth end scenario 'A visitor can access signups through the landing page' do diff --git a/spec/features/member_portal_spec.rb b/spec/features/member_portal_spec.rb index 2d26e0d0a..5f830e512 100644 --- a/spec/features/member_portal_spec.rb +++ b/spec/features/member_portal_spec.rb @@ -90,7 +90,7 @@ end it 'is redirected to sign_in page when they attempt not access the profile page' do - mock_github_auth + mock_codebar_auth visit profile_path expect(page).to_not have_selector('#member_profile') diff --git a/spec/features/member_updating_details_spec.rb b/spec/features/member_updating_details_spec.rb index b6630d364..ab337b0cf 100644 --- a/spec/features/member_updating_details_spec.rb +++ b/spec/features/member_updating_details_spec.rb @@ -1,6 +1,6 @@ RSpec.feature 'Update your details', type: :feature do before do - mock_github_auth + mock_codebar_auth end scenario 'A member adds a dietary restriction' do diff --git a/spec/features/subscribing_to_newsletter_spec.rb b/spec/features/subscribing_to_newsletter_spec.rb index 7a166d009..daffd3bba 100644 --- a/spec/features/subscribing_to_newsletter_spec.rb +++ b/spec/features/subscribing_to_newsletter_spec.rb @@ -1,7 +1,7 @@ RSpec.feature 'Subscribing to the newsletter', type: :feature do before do - OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new( - provider: 'github', + OmniAuth.config.mock_auth[:codebar] = OmniAuth::AuthHash.new( + provider: 'codebar', uid: '42', credentials: { token: 'Fake token' }, info: { diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb index ea2864462..3bd7fd164 100644 --- a/spec/support/helpers/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb @@ -19,8 +19,8 @@ def login_as_organiser(member, chapter) login(member) end - def mock_github_auth - mock_auth_hash + def mock_codebar_auth + mock_auth_hash(provider: 'codebar') end def accept_toc diff --git a/spec/support/omniauth.rb b/spec/support/omniauth.rb index 29e690d30..82f36f857 100644 --- a/spec/support/omniauth.rb +++ b/spec/support/omniauth.rb @@ -1,8 +1,8 @@ require 'omniauth' module OmniauthMacros - def mock_auth_hash(name: Faker::Name.name, email: Faker::Internet.email, provider: 'github', uid: 'uid') - OmniAuth.config.mock_auth[:github] = { + def mock_auth_hash(name: Faker::Name.name, email: Faker::Internet.email, provider: 'codebar', uid: 'uid') + OmniAuth.config.mock_auth[provider.to_sym] = { provider: provider, uid: uid, info: {