The code powering m.abunchtell.com https://m.abunchtell.com
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.
 
 
 
 

36 lines
799 B

  1. # frozen_string_literal: true
  2. module Admin
  3. class ConfirmationsController < BaseController
  4. before_action :set_user
  5. before_action :check_confirmation, only: [:resend]
  6. def create
  7. authorize @user, :confirm?
  8. @user.confirm!
  9. log_action :confirm, @user
  10. redirect_to admin_accounts_path
  11. end
  12. def resend
  13. authorize @user, :confirm?
  14. @user.resend_confirmation_instructions
  15. log_action :confirm, @user
  16. flash[:notice] = I18n.t('admin.accounts.resend_confirmation.success')
  17. redirect_to admin_accounts_path
  18. end
  19. private
  20. def check_confirmation
  21. if @user.confirmed?
  22. flash[:error] = I18n.t('admin.accounts.resend_confirmation.already_confirmed')
  23. redirect_to admin_accounts_path
  24. end
  25. end
  26. end
  27. end