2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
class Profiles::AccountsController < Profiles::ApplicationController
|
2017-08-17 22:00:37 +05:30
|
|
|
include AuthHelper
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
def show
|
2019-02-15 15:39:39 +05:30
|
|
|
render(locals: show_view_variables)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2015-04-26 12:48:37 +05:30
|
|
|
def unlink
|
|
|
|
provider = params[:provider]
|
2017-08-17 22:00:37 +05:30
|
|
|
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-04-26 12:48:37 +05:30
|
|
|
redirect_to profile_account_path
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def show_view_variables
|
|
|
|
{}
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|