From f9f467227538df0ce2012df39dfdcf55fb260f94 Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Mon, 4 Sep 2017 19:23:33 +0200 Subject: Send a confirmation email when the user adds a secondary email address. Utilizes the Devise `confirmable` capabilities. Issue #37385 --- .../_confirmation_instructions_secondary.html.haml | 8 ++++++ .../_confirmation_instructions_secondary.text.erb | 7 +++++ .../mailer/confirmation_instructions.html.haml | 31 ++++++++++++---------- .../mailer/confirmation_instructions.text.erb | 4 +++ 4 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 app/views/devise/mailer/_confirmation_instructions_secondary.html.haml create mode 100644 app/views/devise/mailer/_confirmation_instructions_secondary.text.erb (limited to 'app/views/devise') diff --git a/app/views/devise/mailer/_confirmation_instructions_secondary.html.haml b/app/views/devise/mailer/_confirmation_instructions_secondary.html.haml new file mode 100644 index 00000000000..a716d98415c --- /dev/null +++ b/app/views/devise/mailer/_confirmation_instructions_secondary.html.haml @@ -0,0 +1,8 @@ +#content + = email_default_heading("#{@resource.user.name}, you've added a secondary email!") + %p Click the link below to confirm your email address (#{@resource.email}) +#cta + = link_to 'Confirm your email address', confirmation_url(@resource, confirmation_token: @token) +%p + If this email was added in error, you can remove it here: + = link_to "Emails", profile_emails_url diff --git a/app/views/devise/mailer/_confirmation_instructions_secondary.text.erb b/app/views/devise/mailer/_confirmation_instructions_secondary.text.erb new file mode 100644 index 00000000000..2d8de854cf6 --- /dev/null +++ b/app/views/devise/mailer/_confirmation_instructions_secondary.text.erb @@ -0,0 +1,7 @@ +<%= @resource.user.name %>, you've added a secondary email! + +You can confirm your email (<%= @resource.email %>) through the link below: + +<%= confirmation_url(@resource, confirmation_token: @token) %> + +If this email was added in error, you can remove it here: <%= profile_emails_url %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.haml b/app/views/devise/mailer/confirmation_instructions.html.haml index a508b7537a2..c9e13a636d7 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.haml +++ b/app/views/devise/mailer/confirmation_instructions.html.haml @@ -1,15 +1,18 @@ -- if @resource.unconfirmed_email.present? - #content - = email_default_heading(@resource.unconfirmed_email) - %p Click the link below to confirm your email address. - #cta - = link_to 'Confirm your email address', confirmation_url(@resource, confirmation_token: @token) +- if @resource.is_a?(Email) + = render partial: 'confirmation_instructions_secondary' - else - #content - - if Gitlab.com? - = email_default_heading('Thanks for signing up to GitLab!') - - else - = email_default_heading("Welcome, #{@resource.name}!") - %p To get started, click the link below to confirm your account. - #cta - = link_to 'Confirm your account', confirmation_url(@resource, confirmation_token: @token) + - if @resource.unconfirmed_email.present? + #content + = email_default_heading(@resource.unconfirmed_email) + %p Click the link below to confirm your email address. + #cta + = link_to 'Confirm your email address', confirmation_url(@resource, confirmation_token: @token) + - else + #content + - if Gitlab.com? + = email_default_heading('Thanks for signing up to GitLab!') + - else + = email_default_heading("Welcome, #{@resource.name}!") + %p To get started, click the link below to confirm your account. + #cta + = link_to 'Confirm your account', confirmation_url(@resource, confirmation_token: @token) diff --git a/app/views/devise/mailer/confirmation_instructions.text.erb b/app/views/devise/mailer/confirmation_instructions.text.erb index 9f76edb76a4..d4bfb3af76f 100644 --- a/app/views/devise/mailer/confirmation_instructions.text.erb +++ b/app/views/devise/mailer/confirmation_instructions.text.erb @@ -1,3 +1,6 @@ +<% if @resource.is_a?(Email) %> +<%= render partial: 'confirmation_instructions_secondary' %> +<% else %> Welcome, <%= @resource.name %>! <% if @resource.unconfirmed_email.present? %> @@ -7,3 +10,4 @@ You can confirm your account through the link below: <% end %> <%= confirmation_url(@resource, confirmation_token: @token) %> +<% end %> -- cgit v1.2.3