app/controllers/workarea/admin/users_controller.rb in workarea-admin-3.4.45 vs app/controllers/workarea/admin/users_controller.rb in workarea-admin-3.5.0.beta.1

- old
+ new

@@ -4,10 +4,11 @@ include UserParams required_permissions :people before_action :find_user, except: :index + around_action :inline_metrics_synchronizing after_action :track_index_filters, only: :index def index search_params = params.merge(autocomplete: request.xhr?) @@ -57,10 +58,24 @@ def insights models = Workarea::Insights::Base.by_customer(@user.email) @insights = InsightViewModel.wrap(models, view_model_options) end + def send_password_reset + password_reset = User::PasswordReset.create!(user: @user.model) + Storefront::AccountMailer.password_reset(password_reset.id.to_s).deliver_later + + flash[:success] = t('workarea.admin.users.flash_messages.password_reset') + redirect_to user_path(@user) + end + + def unlock + @user.unlock_login! + flash[:success] = t('workarea.admin.users.flash_messages.unlocked') + redirect_to user_path(@user) + end + private def update_email_signup if params[:email_signup].to_s =~ /true/ && !@user.email_signup? Email.signup(@user.email) @@ -69,9 +84,13 @@ end end def find_user @user = Admin::UserViewModel.new(User.find(params[:id])) + end + + def inline_metrics_synchronizing + Sidekiq::Callbacks.inline(SynchronizeUserMetrics) { yield } end end end end