mirror of
https://github.com/Growstuff/growstuff.git
synced 2025-12-23 17:47:49 -05:00
Remove twitter authentication
This change removes the twitter authentication feature from the application. It removes the `omniauth-twitter` gem and all related code from controllers, views, and tests. It also removes the twitter icon and environment variable settings.
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -94,7 +94,6 @@ gem "bootstrap_form", ">= 4.5.0"
|
||||
# For connecting to other services (eg Twitter)
|
||||
gem 'omniauth', '~> 1.3'
|
||||
gem 'omniauth-flickr', '>= 0.0.15'
|
||||
gem 'omniauth-twitter'
|
||||
|
||||
# Pretty charts
|
||||
gem "chartkick"
|
||||
|
||||
@@ -452,9 +452,6 @@ GEM
|
||||
omniauth-oauth (1.1.0)
|
||||
oauth
|
||||
omniauth (~> 1.0)
|
||||
omniauth-twitter (1.4.0)
|
||||
omniauth-oauth (~> 1.1)
|
||||
rack
|
||||
open-uri (0.1.0)
|
||||
orm_adapter (0.5.0)
|
||||
ostruct (0.6.2)
|
||||
@@ -810,7 +807,6 @@ DEPENDENCIES
|
||||
oj
|
||||
omniauth (~> 1.3)
|
||||
omniauth-flickr (>= 0.0.15)
|
||||
omniauth-twitter
|
||||
percy-capybara (~> 5.0.0)
|
||||
pg
|
||||
platform-api
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB |
@@ -16,7 +16,6 @@ class MembersController < ApplicationController
|
||||
|
||||
def show
|
||||
@member = Member.confirmed.kept.find_by!(slug: params[:slug])
|
||||
@twitter_auth = @member.auth('twitter')
|
||||
@flickr_auth = @member.auth('flickr')
|
||||
@posts = @member.posts
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
@authentication = action.establish_authentication(auth, member)
|
||||
|
||||
if action.member_created?
|
||||
raise "Invalid provider" unless %w(twitter flickr).index(auth['provider'].to_s)
|
||||
raise "Invalid provider" unless %w(flickr).index(auth['provider'].to_s)
|
||||
|
||||
session["devise.#{auth['provider']}_data"] = request.env["omniauth.auth"]
|
||||
sign_in member
|
||||
|
||||
@@ -6,7 +6,6 @@ class RegistrationsController < Devise::RegistrationsController
|
||||
prepend_before_action :check_captcha, only: [:create] # Change this to be any actions you want to protect with recaptcha.
|
||||
|
||||
def edit
|
||||
@twitter_auth = current_member.auth('twitter')
|
||||
@flickr_auth = current_member.auth('flickr')
|
||||
render "edit"
|
||||
end
|
||||
|
||||
@@ -3,19 +3,6 @@
|
||||
html: { method: :put, class: 'form-horizontal' }) do |_f|
|
||||
%br/
|
||||
= render 'devise/shared/error_messages', resource: resource
|
||||
.row
|
||||
.col-md-12
|
||||
%p
|
||||
= image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo'
|
||||
- if @twitter_auth
|
||||
You are connected to Twitter as
|
||||
= link_to @twitter_auth.name, "https://twitter.com/#{@twitter_auth.name}"
|
||||
= link_to "Disconnect", @twitter_auth,
|
||||
confirm: "Are you sure you want to remove this connection?",
|
||||
method: :delete, class: "remove btn btn-danger"
|
||||
- else
|
||||
= link_to 'Connect to Twitter', '/members/auth/twitter', class: 'btn'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
%p
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- if member.website_url.present? || member.instagram_handle.present? || member.facebook_handle.present? || member.bluesky_handle.present? || member.other_url.present? || twitter_auth || flickr_auth || member.show_email
|
||||
- if member.website_url.present? || member.instagram_handle.present? || member.facebook_handle.present? || member.bluesky_handle.present? || member.other_url.present? || flickr_auth || member.show_email
|
||||
%h4 Contact
|
||||
|
||||
- if member.website_url.present?
|
||||
@@ -26,11 +26,6 @@
|
||||
= icon 'fas', 'link', class: 'fa-fw'
|
||||
= link_to "More...", member.other_url, target: '_blank', rel: 'noopener noreferrer'
|
||||
|
||||
- if twitter_auth
|
||||
%p
|
||||
= image_tag "twitter_32.png", size: "32x32", alt: 'Twitter logo'
|
||||
= link_to twitter_auth.name, "https://twitter.com/#{twitter_auth.name}", target: '_blank', rel: 'noopener noreferrer'
|
||||
|
||||
- if flickr_auth
|
||||
%p
|
||||
= image_tag "flickr_32.png", size: "32x32", alt: 'Flickr logo'
|
||||
|
||||
@@ -58,8 +58,7 @@
|
||||
|
||||
= render "stats", member: @member
|
||||
.card-footer
|
||||
= render "contact", member: @member, twitter_auth: @twitter_auth,
|
||||
flickr_auth: @flickr_auth
|
||||
= render "contact", member: @member, flickr_auth: @flickr_auth
|
||||
|
||||
.col-md-10#content
|
||||
.row
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||
provider :twitter, ENV.fetch('GROWSTUFF_TWITTER_KEY', nil), ENV.fetch('GROWSTUFF_TWITTER_SECRET', nil)
|
||||
provider :flickr, ENV.fetch('GROWSTUFF_FLICKR_KEY', nil), ENV.fetch('GROWSTUFF_FLICKR_SECRET', nil), scope: 'read'
|
||||
end
|
||||
|
||||
@@ -40,11 +40,6 @@ GROWSTUFF_SITE_NAME="Growstuff (dev)"
|
||||
GROWSTUFF_MAILCHIMP_APIKEY=""
|
||||
GROWSTUFF_MAILCHIMP_NEWSLETTER_ID=""
|
||||
|
||||
# Used for connecting member accounts to Twitter
|
||||
# Get Twitter key from https://dev.twitter.com/apps
|
||||
GROWSTUFF_TWITTER_KEY=""
|
||||
GROWSTUFF_TWITTER_SECRET=""
|
||||
|
||||
# Used for connecting member accounts to Flickr
|
||||
# Get Flickr key from http://www.flickr.com/services/apps/create/apply/
|
||||
GROWSTUFF_FLICKR_KEY=""
|
||||
|
||||
@@ -61,8 +61,6 @@ class Growstuff::OauthSignupAction
|
||||
|
||||
def determine_name(auth)
|
||||
case auth['provider']
|
||||
when 'twitter'
|
||||
auth['info']['nickname']
|
||||
when 'flickr'
|
||||
auth['info']['name']
|
||||
else
|
||||
|
||||
@@ -5,7 +5,6 @@ require 'rails_helper'
|
||||
describe MembersController do
|
||||
before do
|
||||
@member = FactoryBot.create(:member)
|
||||
@twitter_auth = FactoryBot.create(:authentication, member: @member)
|
||||
@flickr_auth = FactoryBot.create(:flickr_authentication, member: @member)
|
||||
end
|
||||
|
||||
@@ -29,11 +28,6 @@ describe MembersController do
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it "assigns @twitter_auth" do
|
||||
get :show, params: { slug: @member.to_param }
|
||||
expect(assigns(:twitter_auth)).to eq(@twitter_auth)
|
||||
end
|
||||
|
||||
it "assigns @flickr_auth" do
|
||||
get :show, params: { slug: @member.to_param }
|
||||
expect(assigns(:flickr_auth)).to eq(@flickr_auth)
|
||||
|
||||
@@ -16,12 +16,6 @@ describe RegistrationsController do
|
||||
assigns(:member).should eq(@member)
|
||||
end
|
||||
|
||||
it "picks up the twitter auth" do
|
||||
@auth = FactoryBot.create(:authentication, member: @member)
|
||||
get :edit
|
||||
assigns(:twitter_auth).should eq @auth
|
||||
end
|
||||
|
||||
it "picks up the flickr auth" do
|
||||
@auth = FactoryBot.create(:flickr_authentication, member: @member)
|
||||
get :edit
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
FactoryBot.define do
|
||||
factory :authentication do
|
||||
member
|
||||
provider { 'twitter' }
|
||||
provider { 'flickr' }
|
||||
uid { 'foo' }
|
||||
secret { 'bar' }
|
||||
name { 'baz' }
|
||||
|
||||
@@ -76,12 +76,6 @@ describe "member profile", :js do
|
||||
end
|
||||
end
|
||||
|
||||
it "twitter link" do
|
||||
twitter_auth = create(:authentication, member:)
|
||||
visit member_path(member)
|
||||
expect(page).to have_link twitter_auth.name, href: "https://twitter.com/#{twitter_auth.name}"
|
||||
end
|
||||
|
||||
it "flickr link" do
|
||||
flickr_auth = create(:flickr_authentication, member:)
|
||||
visit member_path(member)
|
||||
|
||||
@@ -60,29 +60,6 @@ describe 'devise/registrations/edit.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
context 'other sites section' do
|
||||
context 'not connected to twitter' do
|
||||
it 'has a link to connect' do
|
||||
render
|
||||
assert_select "a", "Connect to Twitter"
|
||||
end
|
||||
end
|
||||
|
||||
context 'connected to twitter' do
|
||||
before do
|
||||
@twitter_auth = FactoryBot.create(:authentication, member: @member)
|
||||
render
|
||||
end
|
||||
|
||||
it 'has a link to twitter profile' do
|
||||
assert_select "a", href: "http://twitter.com/#{@twitter_auth.name}"
|
||||
end
|
||||
|
||||
it 'has a link to disconnect' do
|
||||
render
|
||||
assert_select "a", href: @twitter_auth, text: "Disconnect"
|
||||
end
|
||||
end
|
||||
|
||||
context 'not connected to flickr' do
|
||||
it 'has a link to connect' do
|
||||
render
|
||||
|
||||
Reference in New Issue
Block a user