registrations_controller.rb 571 Bytes
Newer Older
1 2
# frozen_string_literal: true

3 4 5
class Auth::RegistrationsController < Devise::RegistrationsController
  layout 'auth'

Eugen Rochko's avatar
Eugen Rochko committed
6
  before_action :configure_sign_up_params, only: [:create]
7 8 9 10 11

  protected

  def build_resource(hash = nil)
    super(hash)
Eugen Rochko's avatar
Eugen Rochko committed
12
    resource.build_account if resource.account.nil?
13 14 15
  end

  def configure_sign_up_params
Eugen Rochko's avatar
Eugen Rochko committed
16 17
    devise_parameter_sanitizer.permit(:sign_up) do |u|
      u.permit({ account_attributes: [:username] }, :email, :password, :password_confirmation)
18 19 20
    end
  end

21
  def after_sign_up_path_for(_resource)
22
    new_user_session_path
23 24
  end
end