2018-09-14 01:42:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-10-02 08:38:26 -04:00
|
|
|
class ConfirmationsController < Devise::ConfirmationsController
|
2018-05-17 05:19:47 -04:00
|
|
|
include AcceptsPendingInvitations
|
|
|
|
|
2016-03-11 11:14:29 -05:00
|
|
|
def almost_there
|
|
|
|
flash[:notice] = nil
|
|
|
|
render layout: "devise_empty"
|
|
|
|
end
|
|
|
|
|
2014-10-02 08:38:26 -04:00
|
|
|
protected
|
|
|
|
|
2016-03-11 11:14:29 -05:00
|
|
|
def after_resending_confirmation_instructions_path_for(resource)
|
2020-03-11 20:09:34 -04:00
|
|
|
return users_almost_there_path unless Feature.enabled?(:soft_email_confirmation)
|
|
|
|
|
2020-02-05 04:08:43 -05:00
|
|
|
stored_location_for(resource) || dashboard_projects_path
|
2016-03-11 11:14:29 -05:00
|
|
|
end
|
|
|
|
|
2017-10-24 02:23:35 -04:00
|
|
|
def after_confirmation_path_for(resource_name, resource)
|
2018-05-17 05:19:47 -04:00
|
|
|
accept_pending_invitations
|
|
|
|
|
2017-09-04 13:23:33 -04:00
|
|
|
# incoming resource can either be a :user or an :email
|
|
|
|
if signed_in?(:user)
|
2017-09-21 04:29:09 -04:00
|
|
|
after_sign_in(resource)
|
2014-10-02 08:38:26 -04:00
|
|
|
else
|
2017-10-27 10:32:48 -04:00
|
|
|
Gitlab::AppLogger.info("Email Confirmed: username=#{resource.username} email=#{resource.email} ip=#{request.remote_ip}")
|
2019-04-08 10:17:45 -04:00
|
|
|
flash[:notice] = flash[:notice] + _(" Please sign in.")
|
2018-01-01 17:43:16 -05:00
|
|
|
new_session_path(:user, anchor: 'login-pane')
|
2014-10-02 08:38:26 -04:00
|
|
|
end
|
|
|
|
end
|
2017-09-21 04:29:09 -04:00
|
|
|
|
|
|
|
def after_sign_in(resource)
|
|
|
|
after_sign_in_path_for(resource)
|
|
|
|
end
|
2014-10-02 08:38:26 -04:00
|
|
|
end
|
2019-09-13 09:26:31 -04:00
|
|
|
|
|
|
|
ConfirmationsController.prepend_if_ee('EE::ConfirmationsController')
|