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.

39 lines
797 B

  1. # frozen_string_literal: true
  2. class Auth::ConfirmationsController < Devise::ConfirmationsController
  3. layout 'auth'
  4. before_action :set_body_classes
  5. before_action :set_user, only: [:finish_signup]
  6. before_action :set_pack
  7. # GET/PATCH /users/:id/finish_signup
  8. def finish_signup
  9. return unless request.patch? && params[:user]
  10. if @user.update(user_params)
  11. @user.skip_reconfirmation!
  12. bypass_sign_in(@user)
  13. redirect_to root_path, notice: I18n.t('devise.confirmations.send_instructions')
  14. else
  15. @show_errors = true
  16. end
  17. end
  18. private
  19. def set_pack
  20. use_pack 'auth'
  21. end
  22. def set_user
  23. @user = current_user
  24. end
  25. def set_body_classes
  26. @body_classes = 'lighter'
  27. end
  28. def user_params
  29. params.require(:user).permit(:email)
  30. end
  31. end