debian-mirror-gitlab/app/controllers/profiles/accounts_controller.rb

35 lines
765 B
Ruby
Raw Normal View History

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
2019-07-07 11:18:12 +05:30
if unlink_provider_allowed?(provider)
2017-08-17 22:00:37 +05:30
identity.destroy
else
2019-09-04 21:01:54 +05:30
flash[:alert] = _("You are not allowed to unlink your primary login account")
2017-08-17 22:00:37 +05:30
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
2019-12-04 20:38:33 +05:30
Profiles::AccountsController.prepend_if_ee('EE::Profiles::AccountsController')