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
|
|
|
|
@user = current_user
|
|
|
|
end
|
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
|
2013-10-09 09:37:18 -04:00
|
|
|
end
|