25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/decidim/devise/registrations_controller.rb', line 25
def create
@form = form(RegistrationForm).from_params(params[:user].merge(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] = t("error", scope: "decidim.devise.registrations.create")
render :new
end
end
end
|