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
3ffc9384
Commit
3ffc9384
authored
Oct 15, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Require signed in user when updating registration
To prevent errors from happening
parent
28207308
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
27 deletions
+47
-27
app/controllers/registrations_controller.rb
app/controllers/registrations_controller.rb
+2
-0
changelogs/unreleased/267498-failed-test-qa-specs-features-browser_ui-1_manage-login-register_s.yml
...a-specs-features-browser_ui-1_manage-login-register_s.yml
+5
-0
ee/spec/controllers/registrations_controller_spec.rb
ee/spec/controllers/registrations_controller_spec.rb
+31
-24
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+9
-3
No files found.
app/controllers/registrations_controller.rb
View file @
3ffc9384
...
@@ -58,6 +58,8 @@ class RegistrationsController < Devise::RegistrationsController
...
@@ -58,6 +58,8 @@ class RegistrationsController < Devise::RegistrationsController
end
end
def
update_registration
def
update_registration
return
redirect_to
new_user_registration_path
unless
current_user
user_params
=
params
.
require
(
:user
).
permit
(
:role
,
:setup_for_company
)
user_params
=
params
.
require
(
:user
).
permit
(
:role
,
:setup_for_company
)
result
=
::
Users
::
SignupService
.
new
(
current_user
,
user_params
).
execute
result
=
::
Users
::
SignupService
.
new
(
current_user
,
user_params
).
execute
...
...
changelogs/unreleased/267498-failed-test-qa-specs-features-browser_ui-1_manage-login-register_s.yml
0 → 100644
View file @
3ffc9384
---
title
:
Redirect when no user is signed in when updating registration
merge_request
:
45276
author
:
type
:
fixed
ee/spec/controllers/registrations_controller_spec.rb
View file @
3ffc9384
...
@@ -59,12 +59,17 @@ RSpec.describe RegistrationsController do
...
@@ -59,12 +59,17 @@ RSpec.describe RegistrationsController do
end
end
describe
'#update_registration'
do
describe
'#update_registration'
do
subject
(
:update_registration
)
{
patch
:update_registration
,
params:
{
user:
{
role:
'software_developer'
,
setup_for_company:
'false'
}
}
}
context
'without a signed in user'
do
it
{
is_expected
.
to
redirect_to
new_user_registration_path
}
end
context
'with a signed in user'
do
before
do
before
do
sign_in
(
user
)
sign_in
(
user
)
end
end
subject
(
:update_registration
)
{
patch
:update_registration
,
params:
{
user:
{
role:
'software_developer'
,
setup_for_company:
'false'
}
}
}
describe
'redirection'
do
describe
'redirection'
do
it
{
is_expected
.
to
redirect_to
dashboard_projects_path
}
it
{
is_expected
.
to
redirect_to
dashboard_projects_path
}
...
@@ -100,6 +105,7 @@ RSpec.describe RegistrationsController do
...
@@ -100,6 +105,7 @@ RSpec.describe RegistrationsController do
end
end
end
end
end
end
end
describe
'recording the user and tracking events for the onboarding issues experiment'
do
describe
'recording the user and tracking events for the onboarding issues experiment'
do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
...
@@ -113,6 +119,7 @@ RSpec.describe RegistrationsController do
...
@@ -113,6 +119,7 @@ RSpec.describe RegistrationsController do
let
(
:in_trial_flow
)
{
false
}
let
(
:in_trial_flow
)
{
false
}
before
do
before
do
sign_in
(
user
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
on_gitlab_com
)
allow
(
::
Gitlab
).
to
receive
(
:com?
).
and_return
(
on_gitlab_com
)
stub_experiment
(
onboarding_issues:
experiment_enabled
)
stub_experiment
(
onboarding_issues:
experiment_enabled
)
stub_experiment_for_user
(
onboarding_issues:
experiment_enabled_for_user
)
stub_experiment_for_user
(
onboarding_issues:
experiment_enabled_for_user
)
...
...
spec/controllers/registrations_controller_spec.rb
View file @
3ffc9384
...
@@ -477,10 +477,16 @@ RSpec.describe RegistrationsController do
...
@@ -477,10 +477,16 @@ RSpec.describe RegistrationsController do
patch
:update_registration
,
params:
{
user:
{
role:
'software_developer'
,
setup_for_company:
'false'
}
}
patch
:update_registration
,
params:
{
user:
{
role:
'software_developer'
,
setup_for_company:
'false'
}
}
end
end
context
'without a signed in user'
do
it
{
is_expected
.
to
redirect_to
new_user_registration_path
}
end
context
'with a signed in user'
do
before
do
before
do
sign_in
(
create
(
:user
))
sign_in
(
create
(
:user
))
end
end
it
{
is_expected
.
to
redirect_to
(
dashboard_projects_path
)}
it
{
is_expected
.
to
redirect_to
(
dashboard_projects_path
)}
end
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