GRN2-155: Begin preparing for removal of Twitter accounts (#615)

* Add twitter deprecation message

* Fix rspec test

* Extract room switch to its own method

* update method name
This commit is contained in:
shawn-higgins1
2019-07-09 13:06:07 -04:00
committed by Jesus Federico
parent a3158b5872
commit 40b05b1626
8 changed files with 180 additions and 49 deletions

View File

@ -51,6 +51,10 @@ class SessionsController < ApplicationController
@auth = request.env['omniauth.auth']
@user_exists = check_user_exists
if !@user_exists && @auth['provider'] == "twitter"
return redirect_to root_path, flash: { alert: I18n.t("registration.deprecated.twitter_signup") }
end
# If using invitation registration method, make sure user is invited
return redirect_to root_path, flash: { alert: I18n.t("registration.invite.no_invite") } unless passes_invite_reqs
@ -70,6 +74,16 @@ class SessionsController < ApplicationController
invite_registration && !@user_exists
login(user)
if @auth['provider'] == "twitter"
flash[:alert] = if allow_user_signup? && allow_greenlight_accounts?
I18n.t("registration.deprecated.twitter_signin",
link: signup_path(old_twitter_user_id: user.id))
else
I18n.t("registration.deprecated.twitter_signin",
link: signin_path(old_twitter_user_id: user.id))
end
end
rescue => e
logger.error "Error authenticating via omniauth: #{e}"
omniauth_fail