blob: d0dc82c1c7468f9899d23d972c3ca4cf081b1436 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
class Users::RegistrationsController < Devise::RegistrationsController
before_action :configure_sign_up_params, only: [:create]
before_action :configure_account_update_params, only: [:update]
prepend_before_action :accept_user_creation, only: [:new, :create]
protected
def configure_sign_up_params
devise_parameter_sanitizer.for(:sign_up).push(
:name,
:email,
:password,
:password_confirmation,
organisation_attributes: [:name]
)
end
def configure_account_update_params
devise_parameter_sanitizer.for(:account_update).push(
:name,
:email,
:password,
:password_confirmation,
:current_password
)
end
# The default url to be used after updating a resource. You need to overwrite
# this method in your own RegistrationsController.
def after_update_path_for(resource)
organisation_user_path(resource)
end
private
def accept_user_creation
if !Rails.application.config.accept_user_creation
redirect_to unauthenticated_root_path
return false
else
return true
end
end
end
|