By default Gitlab redirects the user to the home page after email confirmation. I want to redirect off-site instead.
I don't think there is a config option for this so I'm asking how to hack it.
I found confirmations_controller.rb
:
# frozen_string_literal: true
class ConfirmationsController < Devise::ConfirmationsController
include AcceptsPendingInvitations
def almost_there
flash[:notice] = nil
render layout: "devise_empty"
end
protected
def after_resending_confirmation_instructions_path_for(resource)
users_almost_there_path
end
def after_confirmation_path_for(resource_name, resource)
accept_pending_invitations
# incoming resource can either be a :user or an :email
if signed_in?(:user)
after_sign_in(resource)
else
Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}")
flash[:notice] = flash[:notice] + " Please sign in."
new_session_path(:user, anchor: 'login-pane')
end
end
def after_sign_in(resource)
after_sign_in_path_for(resource)
end
end
How do I make it redirect me to google.com?
Return from the after_confirmation_path_for
method. Here's an example for Google.
class ConfirmationsController < Devise::ConfirmationsController
...
protected
def after_confirmation_path_for(resource_name, resource)
...
'https://www.google.com' # assuming you're redirecting to Google
end
end