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.

29 lines
715 B

  1. # frozen_string_literal: true
  2. class Auth::RegistrationsController < Devise::RegistrationsController
  3. layout 'auth'
  4. before_action :check_single_user_mode
  5. before_action :configure_sign_up_params, only: [:create]
  6. protected
  7. def build_resource(hash = nil)
  8. super(hash)
  9. resource.build_account if resource.account.nil?
  10. end
  11. def configure_sign_up_params
  12. devise_parameter_sanitizer.permit(:sign_up) do |u|
  13. u.permit({ account_attributes: [:username] }, :email, :password, :password_confirmation)
  14. end
  15. end
  16. def after_sign_up_path_for(_resource)
  17. new_user_session_path
  18. end
  19. def check_single_user_mode
  20. redirect_to root_path if Rails.configuration.x.single_user_mode
  21. end
  22. end