Class: RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Includes:
AcceptsPendingInvitations, BizibleCSP, Gitlab::RackLoadBalancingHelpers, Gitlab::Tracking::Helpers::WeakPasswordErrorEvent, Gitlab::Utils::StrongMemoize, GoogleAnalyticsCSP, GoogleSyndicationCSP, InvisibleCaptchaOnSignup, Onboarding::Redirectable, OneTrustCSP, PreferredLanguageSwitcher, Recaptcha::Adapters::ControllerMethods, RecaptchaHelper, SkipsAlreadySignedInMessage
Defined in:
app/controllers/registrations_controller.rb

Constant Summary

Constants included from PreferredLanguageSwitcherHelper

PreferredLanguageSwitcherHelper::SWITCHER_MINIMUM_TRANSLATION_LEVEL

Constants included from GoogleSyndicationCSP

GoogleSyndicationCSP::ALLOWED_SRC

Instance Method Summary collapse

Methods included from Gitlab::RackLoadBalancingHelpers

#load_balancer_stick_request

Methods included from SkipsAlreadySignedInMessage

#require_no_authentication_without_flash

Methods included from Gitlab::Tracking::Helpers::WeakPasswordErrorEvent

#track_weak_password_error

Methods included from PreferredLanguageSwitcherHelper

#ordered_selectable_locales

Methods included from InvisibleCaptchaOnSignup

#invisible_captcha_honeypot_counter, #invisible_captcha_timestamp_counter, #log_request, #on_honeypot_spam_callback, #on_timestamp_spam_callback

Methods included from RecaptchaHelper

#recaptcha_enabled?, #recaptcha_enabled_on_login?

Methods included from AcceptsPendingInvitations

#accept_pending_invitations

Instance Method Details

#createObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/registrations_controller.rb', line 44

def create
  set_resource_fields

  super do |new_user|
    record_arkose_data
    accept_pending_invitations if new_user.persisted?

    persist_accepted_terms_if_required(new_user)
    send_custom_confirmation_instructions
    track_weak_password_error(new_user, self.class.name, 'create')

    if pending_approval?
      NotificationService.new.new_instance_access_request(new_user)
    end

    after_request_hook(new_user)
  end

  # Devise sets a flash message on both successful & failed signups,
  # but we only want to show a message if the resource is blocked by a pending approval.
  flash[:notice] = nil unless allow_flash_content?(resource)
rescue Gitlab::Access::AccessDeniedError
  redirect_to(new_user_session_path)
end

#destroyObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'app/controllers/registrations_controller.rb', line 69

def destroy
  if current_user.required_terms_not_accepted?
    redirect_to , status: :see_other, alert: s_('Profiles|You must accept the Terms of Service in order to perform this action.')
    return
  end

  if destroy_confirmation_valid?
    current_user.delete_async(deleted_by: current_user)
    session.try(:destroy)
    redirect_to new_user_session_path, status: :see_other, notice: s_('Profiles|Account scheduled for removal.')
  else
    redirect_to , status: :see_other, alert: destroy_confirmation_failure_message
  end
end

#newObject



39
40
41
42
# File 'app/controllers/registrations_controller.rb', line 39

def new
  @resource = build_resource
  set_invite_params
end