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
13e6c289
Commit
13e6c289
authored
Jun 10, 2020
by
Jackie Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pre-fill the invite-email on signin/register pages
parent
85615696
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
3 deletions
+21
-3
app/controllers/invites_controller.rb
app/controllers/invites_controller.rb
+1
-1
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+5
-0
app/views/devise/sessions/_new_base.html.haml
app/views/devise/sessions/_new_base.html.haml
+1
-1
app/views/devise/shared/_signup_box.html.haml
app/views/devise/shared/_signup_box.html.haml
+1
-1
changelogs/unreleased/214100-pre-fill-the-email-input-on-sign-in-sign-up-pages.yml
...100-pre-fill-the-email-input-on-sign-in-sign-up-pages.yml
+5
-0
spec/features/invites_spec.rb
spec/features/invites_spec.rb
+8
-0
No files found.
app/controllers/invites_controller.rb
View file @
13e6c289
...
...
@@ -75,7 +75,7 @@ class InvitesController < ApplicationController
notice
=
notice
.
join
(
' '
)
+
"."
store_location_for
:user
,
request
.
fullpath
redirect_to
new_user_session_path
,
notice:
notice
redirect_to
new_user_session_path
(
invite_email:
member
.
invite_email
)
,
notice:
notice
end
def
invite_details
...
...
app/controllers/sessions_controller.rb
View file @
13e6c289
...
...
@@ -25,6 +25,7 @@ class SessionsController < Devise::SessionsController
before_action
:store_unauthenticated_sessions
,
only:
[
:new
]
before_action
:save_failed_login
,
if: :action_new_and_failed_login?
before_action
:load_recaptcha
before_action
:set_invite_params
,
only:
[
:new
]
after_action
:log_failed_login
,
if: :action_new_and_failed_login?
after_action
:verify_known_sign_in
,
only:
[
:create
]
...
...
@@ -291,6 +292,10 @@ class SessionsController < Devise::SessionsController
"standard"
end
end
def
set_invite_params
@invite_email
=
ActionController
::
Base
.
helpers
.
sanitize
(
params
[
:invite_email
])
end
end
SessionsController
.
prepend_if_ee
(
'EE::SessionsController'
)
app/views/devise/sessions/_new_base.html.haml
View file @
13e6c289
=
form_for
(
resource
,
as:
resource_name
,
url:
session_path
(
resource_name
),
html:
{
class:
'new_user gl-show-field-errors'
,
'aria-live'
=>
'assertive'
})
do
|
f
|
.form-group
=
f
.
label
_
(
'Username or email'
),
for:
'user_login'
,
class:
'label-bold'
=
f
.
text_field
:login
,
class:
'form-control top'
,
autofocus:
'autofocus'
,
autocapitalize:
'off'
,
autocorrect:
'off'
,
required:
true
,
title:
_
(
'This field is required.'
),
data:
{
qa_selector:
'login_field'
}
=
f
.
text_field
:login
,
value:
@invite_email
,
class:
'form-control top'
,
autofocus:
'autofocus'
,
autocapitalize:
'off'
,
autocorrect:
'off'
,
required:
true
,
title:
_
(
'This field is required.'
),
data:
{
qa_selector:
'login_field'
}
.form-group
=
f
.
label
:password
,
class:
'label-bold'
=
f
.
password_field
:password
,
class:
'form-control bottom'
,
required:
true
,
title:
_
(
'This field is required.'
),
data:
{
qa_selector:
'password_field'
}
...
...
app/views/devise/shared/_signup_box.html.haml
View file @
13e6c289
...
...
@@ -19,7 +19,7 @@
%p
.validation-pending.gl-field-error-ignore.field-validation.hide
=
_
(
'Checking username availability...'
)
.form-group
=
f
.
label
:email
,
class:
'label-bold'
=
f
.
email_field
:email
,
class:
"form-control middle"
,
data:
{
qa_selector:
'new_user_email_field'
},
required:
true
,
title:
_
(
"Please provide a valid email address."
)
=
f
.
email_field
:email
,
value:
@invite_email
,
class:
"form-control middle"
,
data:
{
qa_selector:
'new_user_email_field'
},
required:
true
,
title:
_
(
"Please provide a valid email address."
)
.form-group
=
f
.
label
:email_confirmation
,
class:
'label-bold'
=
f
.
email_field
:email_confirmation
,
class:
"form-control middle"
,
data:
{
qa_selector:
'new_user_email_confirmation_field'
},
required:
true
,
title:
_
(
"Please retype the email address."
)
...
...
changelogs/unreleased/214100-pre-fill-the-email-input-on-sign-in-sign-up-pages.yml
0 → 100644
View file @
13e6c289
---
title
:
Pre-fill the email input on sign-in / sign up pages
merge_request
:
33851
author
:
type
:
changed
spec/features/invites_spec.rb
View file @
13e6c289
...
...
@@ -48,6 +48,14 @@ RSpec.describe 'Invites', :aggregate_failures do
expect
(
page
).
to
have_content
(
'To accept this invitation, sign in'
)
end
it
'pre-fills the "Username or email" field on the sign in box with the invite_email from the invite'
do
expect
(
find_field
(
'Username or email'
).
value
).
to
eq
(
group_invite
.
invite_email
)
end
it
'pre-fills the Email field on the sign up box with the invite_email from the invite'
do
expect
(
find_field
(
'Email'
).
value
).
to
eq
(
group_invite
.
invite_email
)
end
it
'sign in, grants access and redirects to group page'
do
fill_in_sign_in_form
(
user
)
...
...
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