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

23 lines
489 B
Ruby
Raw Normal View History

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
@user = current_user
end
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
2014-09-02 18:07:02 +05:30
end