23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'app/controllers/decidim/devise/registrations_controller.rb', line 23
def create
@form = form(RegistrationForm).from_params(params[:user].merge(current_locale: current_locale))
CreateRegistration.call(@form) do
on(:ok) do |user|
if user.active_for_authentication?
set_flash_message! :notice, :signed_up
sign_up(:user, user)
respond_with user, location: after_sign_up_path_for(user)
else
set_flash_message! :notice, :"signed_up_but_#{user.inactive_message}"
expire_data_after_sign_in!
respond_with user, location: after_inactive_sign_up_path_for(user)
end
end
on(:invalid) do
flash.now[:alert] = @form.errors[:base].join(", ") if @form.errors[:base].any?
render :new
end
end
end
|