agenda-libre-ruby/app/admin/user.rb

43 lines
798 B
Ruby
Raw Normal View History

ActiveAdmin.register User do
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
2014-07-18 17:01:51 +02:00
form do |f|
f.inputs 'Admin Details' do
2014-07-18 17:01:51 +02:00
f.input :login
f.input :email
f.input :firstname
f.input :lastname
2014-07-18 17:01:51 +02:00
end
f.actions
end
controller do
def permitted_params
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