Sha256: 1ac48abba1b0a8e43998ef32762cc2322f92619f6e62249a5adbb11792434504
Contents?: true
Size: 1.41 KB
Versions: 16
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module EacUsersSupport module Admin class UsersController < ::EacUsersSupport::ApplicationController record_select per_page: 10, search_on: %i[email], order_by: 'email ASC', model: ::EacUsersSupport::User, full_text_search: true active_scaffold ::EacUsersSupport::User do |conf| conf.action_links.add :password_reset, type: :member, method: :put, position: false, label: ::I18n.t(:'eac_users_support.password_reset.action') conf.columns.exclude :encrypted_password %w[create update list].each do |action| conf.send(action).columns.exclude :remember_created_at end end def password_reset process_action_link_action do |record| record.password = ::Devise.friendly_token if record.save flash[:info] = ::I18n.t(:'eac_users_support.password_reset.successful', user: record, password: record.password) else flash[:error] = ::I18n.t(:'eac_users_support.password_reset.failed', user: user) + ': ' + record.errors.to_s end end end protected def before_create_save(record) record.password = record.email end end end end
Version data entries
16 entries across 16 versions & 1 rubygems