summaryrefslogtreecommitdiff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-30 13:26:49 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-30 13:26:49 +0000
commita2b7634113a2b2f3b9aad86b1a98c52c380e5e76 (patch)
treec9c9ebb914be91d9c5996f708721110276a38be1 /app/controllers/concerns
parent2504d16ea735532cdb5a79403221b5fe262eb65f (diff)
downloadgitlab-ce-a2b7634113a2b2f3b9aad86b1a98c52c380e5e76.tar.gz
Add latest changes from gitlab-org/security/gitlab@15-10-stable-eev15.10.1
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/confirm_email_warning.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/concerns/confirm_email_warning.rb b/app/controllers/concerns/confirm_email_warning.rb
index 8b7371cbc17..2efea461a35 100644
--- a/app/controllers/concerns/confirm_email_warning.rb
+++ b/app/controllers/concerns/confirm_email_warning.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
module ConfirmEmailWarning
+ include Gitlab::Utils::StrongMemoize
extend ActiveSupport::Concern
included do
@@ -17,11 +18,9 @@ module ConfirmEmailWarning
return unless current_user
return if current_user.confirmed?
- email = current_user.unconfirmed_email || current_user.email
-
flash.now[:warning] = format(
confirm_warning_message,
- email: email,
+ email: email_to_display,
resend_link: view_context.link_to(_('Resend it'), user_confirmation_path(user: { email: email }), method: :post),
update_link: view_context.link_to(_('Update it'), profile_path)
).html_safe
@@ -29,7 +28,16 @@ module ConfirmEmailWarning
private
+ def email
+ current_user.unconfirmed_email || current_user.email
+ end
+ strong_memoize_attr :email
+
def confirm_warning_message
_("Please check your email (%{email}) to verify that you own this address and unlock the power of CI/CD. Didn't receive it? %{resend_link}. Wrong email address? %{update_link}.")
end
+
+ def email_to_display
+ html_escape(email)
+ end
end