2018-09-23 15:44:14 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-04-30 13:06:18 -04:00
|
|
|
class Profiles::AccountsController < Profiles::ApplicationController
|
2017-03-28 06:33:51 -04:00
|
|
|
include AuthHelper
|
|
|
|
|
2013-10-09 09:37:18 -04:00
|
|
|
def show
|
2018-12-04 05:31:11 -05:00
|
|
|
render(locals: show_view_variables)
|
2013-10-09 09:37:18 -04:00
|
|
|
end
|
2015-03-21 20:44:40 -04:00
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2015-03-21 20:44:40 -04:00
|
|
|
def unlink
|
|
|
|
provider = params[:provider]
|
2017-03-28 06:33:51 -04:00
|
|
|
identity = current_user.identities.find_by(provider: provider)
|
|
|
|
|
|
|
|
return render_404 unless identity
|
|
|
|
|
|
|
|
if unlink_allowed?(provider)
|
|
|
|
identity.destroy
|
|
|
|
else
|
|
|
|
flash[:alert] = "You are not allowed to unlink your primary login account"
|
|
|
|
end
|
|
|
|
|
2015-03-21 20:44:40 -04:00
|
|
|
redirect_to profile_account_path
|
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2018-12-04 05:31:11 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def show_view_variables
|
2018-12-04 05:17:21 -05:00
|
|
|
{}
|
2018-12-04 05:31:11 -05:00
|
|
|
end
|
2013-10-09 09:37:18 -04:00
|
|
|
end
|