Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
70868745
Commit
70868745
authored
Jul 14, 2020
by
Dan Jensen
Committed by
Michael Kozono
Jul 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use existing-user language in reconfirmation email
parent
6c97d4ed
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
5 deletions
+40
-5
app/models/user.rb
app/models/user.rb
+4
-0
app/views/devise/mailer/_confirmation_instructions_account.html.haml
...evise/mailer/_confirmation_instructions_account.html.haml
+2
-2
app/views/devise/mailer/_confirmation_instructions_account.text.erb
...devise/mailer/_confirmation_instructions_account.text.erb
+2
-3
changelogs/unreleased/219558-improve-confirmation-email-language.yml
...unreleased/219558-improve-confirmation-email-language.yml
+5
-0
spec/mailers/devise_mailer_spec.rb
spec/mailers/devise_mailer_spec.rb
+27
-0
No files found.
app/models/user.rb
View file @
70868745
...
...
@@ -1697,6 +1697,10 @@ class User < ApplicationRecord
impersonator
.
present?
end
def
created_recently?
created_at
>
Devise
.
confirm_within
.
ago
end
protected
# override, from Devise::Validatable
...
...
app/views/devise/mailer/_confirmation_instructions_account.html.haml
View file @
70868745
-
confirmation_link
=
confirmation_url
(
@resource
,
confirmation_token:
@token
)
-
if
@resource
.
unconfirmed_email
.
present?
-
if
@resource
.
unconfirmed_email
.
present?
||
!
@resource
.
created_recently?
#content
=
email_default_heading
(
@resource
.
unconfirmed_email
)
=
email_default_heading
(
@resource
.
unconfirmed_email
||
@resource
.
email
)
%p
Click the link below to confirm your email address.
#cta
=
link_to
'Confirm your email address'
,
confirmation_link
...
...
app/views/devise/mailer/_confirmation_instructions_account.text.erb
View file @
70868745
<%
if
@resource
.
unconfirmed_email
.
present?
%>
<%=
@resource
.
unconfirmed_email
%>
,
<%
if
@resource
.
unconfirmed_email
.
present?
||
!
@resource
.
created_recently?
%>
<%=
@resource
.
unconfirmed_email
||
@resource
.
email
%>
,
Use the link below to confirm your email address.
<%
else
%>
<%
if
Gitlab
.
com?
%>
...
...
changelogs/unreleased/219558-improve-confirmation-email-language.yml
0 → 100644
View file @
70868745
---
title
:
Replace misleading text in re-confirmation emails
merge_request
:
36634
author
:
type
:
security
spec/mailers/devise_mailer_spec.rb
0 → 100644
View file @
70868745
# frozen_string_literal: true
require
'spec_helper'
require
'email_spec'
RSpec
.
describe
DeviseMailer
do
describe
"#confirmation_instructions"
do
subject
{
described_class
.
confirmation_instructions
(
user
,
'faketoken'
,
{})
}
context
"when confirming the unconfirmed_email"
do
let
(
:user
)
{
build
(
:user
,
unconfirmed_email:
'jdoe@example.com'
)
}
it
"shows the unconfirmed_email"
do
expect
(
subject
.
body
.
encoded
).
to
have_text
user
.
unconfirmed_email
expect
(
subject
.
body
.
encoded
).
not_to
have_text
user
.
email
end
end
context
"when re-confirming the primary email after a security issue"
do
let
(
:user
)
{
build
(
:user
,
created_at:
10
.
days
.
ago
,
unconfirmed_email:
nil
)
}
it
"shows the primary email"
do
expect
(
subject
.
body
.
encoded
).
to
have_text
user
.
email
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment