summaryrefslogtreecommitdiff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2019-08-16 12:31:16 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2019-08-16 12:31:16 +0000
commitb1604f7d8f0095d637036721244830e8d3181596 (patch)
tree10caf704bd6326c31e808b5a437d0bdbef6a5ff3 /app/controllers/concerns
parent1441b23a4a9edce15e356e1543f7ff6fafc105ba (diff)
parent54ddc018ac71f0ec7379c8528144bb9192ced510 (diff)
downloadgitlab-ce-b1604f7d8f0095d637036721244830e8d3181596.tar.gz
Merge branch '47003-user-onboarding-replace-current-email-confirmation-flow-with-a-soft-email-confirmation-flow' into 'master'
Soft email confirmation flow Closes #47003 See merge request gitlab-org/gitlab-ce!31245
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/confirm_email_warning.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/controllers/concerns/confirm_email_warning.rb b/app/controllers/concerns/confirm_email_warning.rb
new file mode 100644
index 00000000000..5a4b5897a4f
--- /dev/null
+++ b/app/controllers/concerns/confirm_email_warning.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module ConfirmEmailWarning
+ extend ActiveSupport::Concern
+
+ included do
+ before_action :set_confirm_warning, if: -> { Feature.enabled?(:soft_email_confirmation) }
+ end
+
+ protected
+
+ def set_confirm_warning
+ return unless current_user
+ return if current_user.confirmed?
+ return if peek_request? || json_request? || !request.get?
+
+ email = current_user.unconfirmed_email || current_user.email
+
+ flash.now[:warning] = _("Please check your email (%{email}) to verify that you own this address. Didn't receive it? %{resend_link}. Wrong email address? %{update_link}.").html_safe % {
+ email: email,
+ 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)
+ }
+ end
+end