闭社主体 forked from https://github.com/tootsuite/mastodon
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.

34 lines
729 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. # GET/PATCH /users/:id/finish_signup
  7. def finish_signup
  8. return unless request.patch? && params[:user]
  9. if @user.update(user_params)
  10. @user.skip_reconfirmation!
  11. bypass_sign_in(@user)
  12. redirect_to root_path, notice: I18n.t('devise.confirmations.send_instructions')
  13. else
  14. @show_errors = true
  15. end
  16. end
  17. private
  18. def set_user
  19. @user = current_user
  20. end
  21. def set_body_classes
  22. @body_classes = 'lighter'
  23. end
  24. def user_params
  25. params.require(:user).permit(:email)
  26. end
  27. end