You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
632 B

  1. # frozen_string_literal: true
  2. class Settings::DeletesController < ApplicationController
  3. layout 'admin'
  4. before_action :authenticate_user!
  5. def show
  6. @confirmation = Form::DeleteConfirmation.new
  7. end
  8. def destroy
  9. if current_user.valid_password?(delete_params[:password])
  10. Admin::SuspensionWorker.perform_async(current_user.account_id, true)
  11. sign_out
  12. redirect_to new_user_session_path, notice: I18n.t('deletes.success_msg')
  13. else
  14. redirect_to settings_delete_path, alert: I18n.t('deletes.bad_password_msg')
  15. end
  16. end
  17. private
  18. def delete_params
  19. params.permit(:password)
  20. end
  21. end