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
670c9ea3
Commit
670c9ea3
authored
Feb 26, 2021
by
Bryan Miller
Committed by
Bob Van Landuyt
Feb 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Omniauth callback spec"
This reverts commit f68b0cdbcb9320009d2aba170952ec0873e9da8c.
parent
d6b39535
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
changelogs/unreleased/user-auth-bmiller-return-early-if-user-is-nil.yml
...eleased/user-auth-bmiller-return-early-if-user-is-nil.yml
+5
-0
lib/gitlab/auth/o_auth/user.rb
lib/gitlab/auth/o_auth/user.rb
+2
-1
spec/lib/gitlab/auth/o_auth/user_spec.rb
spec/lib/gitlab/auth/o_auth/user_spec.rb
+17
-0
No files found.
changelogs/unreleased/user-auth-bmiller-return-early-if-user-is-nil.yml
0 → 100644
View file @
670c9ea3
---
title
:
Fix a crash when logging in using SAML for the first time when sign-ups are disabled
merge_request
:
50216
author
:
type
:
other
lib/gitlab/auth/o_auth/user.rb
View file @
670c9ea3
...
@@ -239,8 +239,9 @@ module Gitlab
...
@@ -239,8 +239,9 @@ module Gitlab
end
end
def
update_profile
def
update_profile
clear_user_synced_attributes_metadata
return
unless
gl_user
clear_user_synced_attributes_metadata
return
unless
sync_profile_from_provider?
||
creating_linked_ldap_user?
return
unless
sync_profile_from_provider?
||
creating_linked_ldap_user?
metadata
=
gl_user
.
build_user_synced_attributes_metadata
metadata
=
gl_user
.
build_user_synced_attributes_metadata
...
...
spec/lib/gitlab/auth/o_auth/user_spec.rb
View file @
670c9ea3
...
@@ -995,6 +995,23 @@ RSpec.describe Gitlab::Auth::OAuth::User do
...
@@ -995,6 +995,23 @@ RSpec.describe Gitlab::Auth::OAuth::User do
end
end
end
end
context
'when gl_user is nil'
do
# We can't use `allow_next_instance_of` here because the stubbed method is called inside `initialize`.
# When the class calls `gl_user` during `initialize`, the `nil` value is overwritten and we do not see expected results from the spec.
# So we use `allow_any_instance_of` to preserve the `nil` value to test the behavior when `gl_user` is nil.
# rubocop:disable RSpec/AnyInstanceOf
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:gl_user
)
{
nil
}
allow_any_instance_of
(
described_class
).
to
receive
(
:sync_profile_from_provider?
)
{
true
}
# to make the code flow proceed until gl_user.build_user_synced_attributes_metadata is called
end
# rubocop:enable RSpec/AnyInstanceOf
it
'does not raise NoMethodError'
do
expect
{
oauth_user
}.
not_to
raise_error
end
end
describe
'._uid_and_provider'
do
describe
'._uid_and_provider'
do
let!
(
:existing_user
)
{
create
(
:omniauth_user
,
extern_uid:
'my-uid'
,
provider:
'my-provider'
)
}
let!
(
:existing_user
)
{
create
(
:omniauth_user
,
extern_uid:
'my-uid'
,
provider:
'my-provider'
)
}
...
...
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