Class: RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Includes:
AcceptsPendingInvitations, BizibleCSP, Gitlab::RackLoadBalancingHelpers, Gitlab::Tracking::Helpers::WeakPasswordErrorEvent, Gitlab::Utils::StrongMemoize, 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

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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/registrations_controller.rb', line 40

def create
  store_duration(:set_resource_fields) { set_resource_fields }

  devise_call_start_time = current_monotonic_time

  super do |new_user|
    if new_user.persisted?
      store_duration(:devise_create_user, devise_call_start_time)
      store_duration(:after_successful_create_hook) { after_successful_create_hook(new_user) }
    else
      store_duration(:track_error) { track_error(new_user) }
    end
  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)
  log_registration_metrics
rescue Gitlab::Access::AccessDeniedError
  redirect_to(new_user_session_path)
end

#destroyObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/controllers/registrations_controller.rb', line 61

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



35
36
37
38
# File 'app/controllers/registrations_controller.rb', line 35

def new
  @resource = build_resource
  set_invite_params
end