The moderator creation should be finalised
This commit is contained in:
parent
129bf02113
commit
37225e0691
@ -21,15 +21,22 @@ ActiveAdmin.register User do
|
||||
f.input :email
|
||||
f.input :firstname
|
||||
f.input :lastname
|
||||
f.input :password
|
||||
f.input :password_confirmation
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
controller do
|
||||
def permitted_params
|
||||
params.permit admin_user: %i[login email firstname lastname password
|
||||
password_confirmation]
|
||||
params.permit user: %i[login email firstname lastname]
|
||||
end
|
||||
end
|
||||
|
||||
before_create do |user|
|
||||
user.password = Devise.friendly_token.first(8)
|
||||
end
|
||||
|
||||
after_create do |user|
|
||||
logger.info 'Sending initialisation mail to moderator'
|
||||
user.send_reset_password_instructions
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
# The top level controller, where can be centralised almost everything
|
||||
class ApplicationController < ActionController::Base
|
||||
before_action :set_paper_trail_whodunnit, :set_locale, :discard
|
||||
before_action :set_mailer_host, if: :devise_controller?
|
||||
before_action :set_paper_trail_whodunnit, :set_locale, :discard,
|
||||
:set_mailer_host
|
||||
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
|
@ -9,7 +9,6 @@ class EventsController < ApplicationController
|
||||
before_action :set_event, except: %i[index new preview_create create]
|
||||
before_action :set_create_event, only: %i[new preview_create create]
|
||||
before_action :check_secret, only: %i[edit preview update destroy]
|
||||
before_action :set_mailer_host, only: %i[create update destroy]
|
||||
rescue_from ActiveRecord::StaleObjectError, with: :locked
|
||||
|
||||
def index
|
||||
|
@ -4,7 +4,7 @@ class ModerationsController < ApplicationController
|
||||
has_scope :near, type: :hash, using: %i[location distance]
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :set_moderation, :set_mailer_host, only:
|
||||
before_action :set_moderation, only:
|
||||
%i[show edit preview update validate accept refuse destroy]
|
||||
before_action :generate_destroy_reason, only: :destroy
|
||||
rescue_from ActiveRecord::StaleObjectError, with: :locked
|
||||
@ -14,6 +14,14 @@ class ModerationsController < ApplicationController
|
||||
@orgas = Orga.unmoderated
|
||||
end
|
||||
|
||||
def show; end
|
||||
|
||||
def edit; end
|
||||
|
||||
def validate; end
|
||||
|
||||
def refuse; end
|
||||
|
||||
def preview
|
||||
@moderation.attributes = moderation_params
|
||||
@moderation.valid?
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Events, particulary during moderation, can have notes associated to them
|
||||
class NotesController < ApplicationController
|
||||
before_action :set_event, only: %i[new create]
|
||||
before_action :create_note, :set_mailer_host, only: %i[create]
|
||||
before_action :create_note, only: %i[create]
|
||||
|
||||
# GET /moderations/id/new
|
||||
def new
|
||||
|
@ -5,7 +5,6 @@ class OrgasController < ApplicationController
|
||||
has_scope :active, type: :boolean, default: true, allow_blank: true
|
||||
|
||||
before_action :set_orga, except: %i[index new create]
|
||||
before_action :set_mailer_host
|
||||
before_action :authenticate_user!, except: %i[index new create show],
|
||||
unless: :check_secret
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
.field.login
|
||||
= f.label :login
|
||||
%br/
|
||||
= f.email_field :login, autofocus: true, autocomplete: "login"
|
||||
= f.text_field :login, autofocus: true, autocomplete: "login"
|
||||
.field.password
|
||||
= f.label :password
|
||||
%br/
|
||||
|
@ -43,7 +43,8 @@ Rails.application.routes.draw do
|
||||
|
||||
devise_for :users, skip: [:registrations]
|
||||
as :user do
|
||||
get 'users/edit' => 'devise/registrations#edit', as: 'edit_user_registration'
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user