2013-11-14 17:07:48 +01:00
|
|
|
ActiveAdmin.register User do
|
2019-05-10 15:33:19 +02:00
|
|
|
index do
|
|
|
|
column :login
|
|
|
|
column :email
|
|
|
|
column :firstname
|
|
|
|
column :lastname
|
|
|
|
column :current_sign_in_at
|
|
|
|
column :last_sign_in_at
|
|
|
|
column :sign_in_count
|
|
|
|
actions
|
|
|
|
end
|
|
|
|
|
|
|
|
filter :login
|
|
|
|
filter :email
|
|
|
|
filter :firstname
|
|
|
|
filter :lastname
|
2013-11-14 17:07:48 +01:00
|
|
|
|
2014-07-18 17:01:51 +02:00
|
|
|
form do |f|
|
2019-05-10 15:33:19 +02:00
|
|
|
f.inputs 'Admin Details' do
|
2014-07-18 17:01:51 +02:00
|
|
|
f.input :login
|
|
|
|
f.input :email
|
2019-05-10 15:33:19 +02:00
|
|
|
f.input :firstname
|
|
|
|
f.input :lastname
|
2014-07-18 17:01:51 +02:00
|
|
|
end
|
|
|
|
f.actions
|
|
|
|
end
|
2019-05-11 15:01:10 +02:00
|
|
|
|
2019-05-10 15:33:19 +02:00
|
|
|
controller do
|
|
|
|
def permitted_params
|
2019-05-11 15:01:10 +02:00
|
|
|
params.permit user: %i[login email firstname lastname]
|
2019-05-10 15:33:19 +02:00
|
|
|
end
|
|
|
|
end
|
2019-05-11 15:01:10 +02:00
|
|
|
|
|
|
|
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
|
2013-11-14 17:07:48 +01:00
|
|
|
end
|