retrospring/app/controllers/user/registrations_controller.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
826 B
Ruby
Raw Normal View History

2024-08-09 05:53:37 +02:00
# frozen_string_literal: true
class User::RegistrationsController < Devise::RegistrationsController
before_action :redirect_if_registrations_disabled!, only: %w[create new] # rubocop:disable Rails/LexicallyScopedActionFilter
2024-08-09 05:53:37 +02:00
def destroy
2024-09-04 22:43:13 +02:00
# TODO: destroy export async
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
resource.destroy
set_flash_message :notice, :destroyed if is_flashing_format?
yield resource if block_given?
2024-08-09 05:53:37 +02:00
respond_with_navigational(resource) { redirect_to after_sign_out_path_for(resource_name) }
end
2020-05-23 16:49:03 +02:00
private
def captcha_valid?
# If the captcha isn't enabled, treat it as being correct
return true unless APP_CONFIG.dig(:hcaptcha, :enabled)
verify_hcaptcha
end
2024-08-09 05:53:37 +02:00
def redirect_if_registrations_disabled!
2024-09-04 22:43:13 +02:00
redirect_to root_path
2024-08-09 05:53:37 +02:00
end
end