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 :email
|
||||||
f.input :firstname
|
f.input :firstname
|
||||||
f.input :lastname
|
f.input :lastname
|
||||||
f.input :password
|
|
||||||
f.input :password_confirmation
|
|
||||||
end
|
end
|
||||||
f.actions
|
f.actions
|
||||||
end
|
end
|
||||||
|
|
||||||
controller do
|
controller do
|
||||||
def permitted_params
|
def permitted_params
|
||||||
params.permit admin_user: %i[login email firstname lastname password
|
params.permit user: %i[login email firstname lastname]
|
||||||
password_confirmation]
|
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# The top level controller, where can be centralised almost everything
|
# The top level controller, where can be centralised almost everything
|
||||||
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?
|
:set_mailer_host
|
||||||
before_action :configure_permitted_parameters, 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.
|
||||||
|
@ -9,7 +9,6 @@ class EventsController < ApplicationController
|
|||||||
before_action :set_event, except: %i[index new preview_create create]
|
before_action :set_event, except: %i[index new preview_create create]
|
||||||
before_action :set_create_event, only: %i[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 :check_secret, only: %i[edit preview update destroy]
|
||||||
before_action :set_mailer_host, only: %i[create update destroy]
|
|
||||||
rescue_from ActiveRecord::StaleObjectError, with: :locked
|
rescue_from ActiveRecord::StaleObjectError, with: :locked
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -4,7 +4,7 @@ class ModerationsController < ApplicationController
|
|||||||
has_scope :near, type: :hash, using: %i[location distance]
|
has_scope :near, type: :hash, using: %i[location distance]
|
||||||
|
|
||||||
before_action :authenticate_user!
|
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]
|
%i[show edit preview update validate accept refuse destroy]
|
||||||
before_action :generate_destroy_reason, only: :destroy
|
before_action :generate_destroy_reason, only: :destroy
|
||||||
rescue_from ActiveRecord::StaleObjectError, with: :locked
|
rescue_from ActiveRecord::StaleObjectError, with: :locked
|
||||||
@ -14,6 +14,14 @@ class ModerationsController < ApplicationController
|
|||||||
@orgas = Orga.unmoderated
|
@orgas = Orga.unmoderated
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def show; end
|
||||||
|
|
||||||
|
def edit; end
|
||||||
|
|
||||||
|
def validate; end
|
||||||
|
|
||||||
|
def refuse; end
|
||||||
|
|
||||||
def preview
|
def preview
|
||||||
@moderation.attributes = moderation_params
|
@moderation.attributes = moderation_params
|
||||||
@moderation.valid?
|
@moderation.valid?
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Events, particulary during moderation, can have notes associated to them
|
# Events, particulary during moderation, can have notes associated to them
|
||||||
class NotesController < ApplicationController
|
class NotesController < ApplicationController
|
||||||
before_action :set_event, only: %i[new create]
|
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
|
# GET /moderations/id/new
|
||||||
def new
|
def new
|
||||||
|
@ -5,7 +5,6 @@ class OrgasController < ApplicationController
|
|||||||
has_scope :active, type: :boolean, default: true, allow_blank: true
|
has_scope :active, type: :boolean, default: true, allow_blank: true
|
||||||
|
|
||||||
before_action :set_orga, except: %i[index new create]
|
before_action :set_orga, except: %i[index new create]
|
||||||
before_action :set_mailer_host
|
|
||||||
before_action :authenticate_user!, except: %i[index new create show],
|
before_action :authenticate_user!, except: %i[index new create show],
|
||||||
unless: :check_secret
|
unless: :check_secret
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
.field.login
|
.field.login
|
||||||
= f.label :login
|
= f.label :login
|
||||||
%br/
|
%br/
|
||||||
= f.email_field :login, autofocus: true, autocomplete: "login"
|
= f.text_field :login, autofocus: true, autocomplete: "login"
|
||||||
.field.password
|
.field.password
|
||||||
= f.label :password
|
= f.label :password
|
||||||
%br/
|
%br/
|
||||||
|
@ -43,7 +43,8 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
devise_for :users, skip: [:registrations]
|
devise_for :users, skip: [:registrations]
|
||||||
as :user do
|
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'
|
put 'users' => 'devise/registrations#update', as: 'user_registration'
|
||||||
end
|
end
|
||||||
devise_for :admin_users, ActiveAdmin::Devise.config
|
devise_for :admin_users, ActiveAdmin::Devise.config
|
||||||
|
Loading…
Reference in New Issue
Block a user