User mgmt (moderators), to allow for password changes

This commit is contained in:
echarp 2019-05-10 18:07:04 +02:00
parent 04787793f4
commit 129bf02113
4 changed files with 14 additions and 10 deletions

View File

@ -4,11 +4,10 @@ ActiveAdmin.register_page 'Dashboard' do
content title: proc { I18n.t('active_admin.dashboard') } do content title: proc { I18n.t('active_admin.dashboard') } do
columns do columns do
column do column do
panel 'Moderateurs' do panel link_to 'Moderateurs', :admin_users do
ul do ul do
User.all.map do |user| User.all.map do |user|
li link_to("#{user.firstname} #{user.lastname} (#{user.login})", li "#{user.firstname} #{user.lastname} (#{user.login})"
user)
end end
end end
end end

View File

@ -18,12 +18,6 @@
display: inline-block !important display: inline-block !important
position: relative !important position: relative !important
.tags #map
width: 40%
height: 60em
margin: 1.6em 2%
display: inline-block
// Left align the map controls placed in the top right corner // Left align the map controls placed in the top right corner
section.leaflet-control-layers-list label section.leaflet-control-layers-list label
.awesome-marker .awesome-marker

View File

@ -2,6 +2,8 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
before_action :set_paper_trail_whodunnit, :set_locale, :discard before_action :set_paper_trail_whodunnit, :set_locale, :discard
before_action :set_mailer_host, if: :devise_controller? before_action :set_mailer_host, if: :devise_controller?
before_action :configure_permitted_parameters, if: :devise_controller?
# Prevent CSRF attacks by raising an exception. # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
protect_from_forgery prepend: true, with: :exception protect_from_forgery prepend: true, with: :exception
@ -34,4 +36,9 @@ class ApplicationController < ActionController::Base
def handle_xhr_layout def handle_xhr_layout
request.xhr? ? false : 'application' request.xhr? ? false : 'application'
end end
def configure_permitted_parameters
update_attrs = %i[password password_confirmation current_password]
devise_parameter_sanitizer.permit :account_update, keys: update_attrs
end
end end

View File

@ -41,7 +41,11 @@ Rails.application.routes.draw do
get '(:format).php', get '(:format).php',
to: redirect { |_, r| "events.#{r.format.to_sym}?#{r.query_string}" } to: redirect { |_, r| "events.#{r.format.to_sym}?#{r.query_string}" }
devise_for :users devise_for :users, skip: [:registrations]
as :user do
get 'users/edit' => 'devise/registrations#edit', as: 'edit_user_registration'
put 'users' => 'devise/registrations#update', as: 'user_registration'
end
devise_for :admin_users, ActiveAdmin::Devise.config devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self) ActiveAdmin.routes(self)