Class: ConfirmationsController

Inherits:
Devise::ConfirmationsController
  • Object
show all
Includes:
AcceptsPendingInvitations, GitlabRecaptcha, OneTrustCSP
Defined in:
app/controllers/confirmations_controller.rb

Instance Method Summary collapse

Methods included from GitlabRecaptcha

#load_recaptcha

Methods included from RecaptchaHelper

#recaptcha_enabled?, #recaptcha_enabled_on_login?

Methods included from AcceptsPendingInvitations

#accept_pending_invitations, #after_pending_invitations_hook

Instance Method Details

#almost_thereObject



13
14
15
16
# File 'app/controllers/confirmations_controller.rb', line 13

def almost_there
  flash[:notice] = nil
  render layout: "devise_empty"
end

#showObject

modified from Devise::ConfirmationsController github.com/heartcombo/devise/blob/e9c534d363cc9d552662049b38582eead87bedd6/app/controllers/devise/confirmations_controller.rb#L22 since we must accept a user_id sharding param and use it in the lookup for Email confirmations, but User confirmations should remain unchanged

this override can be removed once emails table is re-sharded to organization_id and we’ve refactored to override Email.confirm_by_token instead gitlab.com/gitlab-org/gitlab/-/work_items/585903



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/confirmations_controller.rb', line 26

def show
  return super unless resource_class == Email && email_confirmation_params[:user_id].present?

  self.resource = confirm_email_by_token(
    email_confirmation_params[:user_id],
    email_confirmation_params[:confirmation_token]
  )

  if resource.errors.empty?
    set_flash_message!(:notice, :confirmed)
    respond_with_navigational(resource) { redirect_to after_confirmation_path_for(resource_name, resource) }
  else
    respond_with_navigational(resource.errors, status: :unprocessable_entity) { render :new }
  end
end