mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Allow user to remove openid
This commit is contained in:
parent
703dce4f5c
commit
be72b9d02e
4 changed files with 19 additions and 2 deletions
9
app/controllers/openids_controller.rb
Normal file
9
app/controllers/openids_controller.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class OpenidsController < ApplicationController
|
||||
load_and_authorize_resource :user
|
||||
load_and_authorize_resource through: :user
|
||||
|
||||
def destroy
|
||||
@openid.destroy
|
||||
redirect_to :back
|
||||
end
|
||||
end
|
||||
|
|
@ -100,6 +100,8 @@ class Ability
|
|||
|
||||
# can manage the commercials of their own events
|
||||
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
|
||||
|
||||
can [:destroy], Openid
|
||||
end
|
||||
|
||||
# Abilities for signed in users with roles
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@
|
|||
%h4
|
||||
Currently the following openIDs are associated with your account
|
||||
- @openids.each do |openid|
|
||||
%li= "#{openid.provider}:#{openid.email}"
|
||||
%li{ style: "list-style: none; margin-left: 20px;" }
|
||||
= link_to user_openid_path(openid, user_id: current_user.id), method: :delete,
|
||||
data: { confirm: "Remove association with #{openid.provider} account?" } do
|
||||
%span.fa.fa-times{ style: "color: red;" }
|
||||
%span #{openid.provider}:#{openid.email}
|
||||
%br
|
||||
%h4
|
||||
To add an openID with a different email address to your account, sign in with your
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ Osem::Application.routes.draw do
|
|||
mount LetterOpenerWeb::Engine, at: "/letter_opener"
|
||||
end
|
||||
|
||||
resources :users, except: [:new, :index, :create, :destroy]
|
||||
resources :users, except: [:new, :index, :create, :destroy] do
|
||||
resources :openids, only: :destroy
|
||||
end
|
||||
|
||||
namespace :admin do
|
||||
resources :organizations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue