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
8df3f70c
Commit
8df3f70c
authored
Sep 20, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs
parent
9efeb572
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
22 additions
and
9 deletions
+22
-9
app/services/emails/create_service.rb
app/services/emails/create_service.rb
+1
-1
app/services/emails/destroy_service.rb
app/services/emails/destroy_service.rb
+1
-1
app/services/users/update_service.rb
app/services/users/update_service.rb
+9
-3
ee/app/services/ee/emails/create_service.rb
ee/app/services/ee/emails/create_service.rb
+1
-1
ee/app/services/ee/emails/destroy_service.rb
ee/app/services/ee/emails/destroy_service.rb
+1
-1
ee/app/services/ee/users/update_service.rb
ee/app/services/ee/users/update_service.rb
+2
-2
spec/features/login_spec.rb
spec/features/login_spec.rb
+4
-0
spec/lib/ee/audit/changes_spec.rb
spec/lib/ee/audit/changes_spec.rb
+3
-0
No files found.
app/services/emails/create_service.rb
View file @
8df3f70c
module
Emails
module
Emails
class
CreateService
<
::
Emails
::
BaseService
class
CreateService
<
::
Emails
::
BaseService
prepend
EE
::
Emails
::
CreateService
prepend
::
EE
::
Emails
::
CreateService
def
execute
def
execute
@user
.
emails
.
create
(
email:
@email
)
@user
.
emails
.
create
(
email:
@email
)
...
...
app/services/emails/destroy_service.rb
View file @
8df3f70c
module
Emails
module
Emails
class
DestroyService
<
::
Emails
::
BaseService
class
DestroyService
<
::
Emails
::
BaseService
prepend
EE
::
Emails
::
DestroyService
prepend
::
EE
::
Emails
::
DestroyService
def
execute
def
execute
update_secondary_emails!
if
Email
.
find_by_email!
(
@email
).
destroy
update_secondary_emails!
if
Email
.
find_by_email!
(
@email
).
destroy
...
...
app/services/users/update_service.rb
View file @
8df3f70c
...
@@ -14,8 +14,10 @@ module Users
...
@@ -14,8 +14,10 @@ module Users
assign_attributes
(
&
block
)
assign_attributes
(
&
block
)
user_exists
=
@user
.
persisted?
if
@user
.
save
(
validate:
validate
)
if
@user
.
save
(
validate:
validate
)
notify_success
notify_success
(
user_exists
)
else
else
error
(
@user
.
errors
.
full_messages
.
uniq
.
join
(
'. '
))
error
(
@user
.
errors
.
full_messages
.
uniq
.
join
(
'. '
))
end
end
...
@@ -31,8 +33,8 @@ module Users
...
@@ -31,8 +33,8 @@ module Users
protected
protected
def
notify_success
def
notify_success
(
user_exists
)
notify_new_user
(
@user
,
nil
)
unless
@user
.
persisted?
notify_new_user
(
@user
,
nil
)
unless
user_exists
success
success
end
end
...
@@ -40,6 +42,10 @@ module Users
...
@@ -40,6 +42,10 @@ module Users
private
private
def
assign_attributes
(
&
block
)
def
assign_attributes
(
&
block
)
if
@user
.
user_synced_attributes_metadata
params
.
except!
(
*
@user
.
user_synced_attributes_metadata
.
read_only_attributes
)
end
@user
.
assign_attributes
(
params
)
if
params
.
any?
@user
.
assign_attributes
(
params
)
if
params
.
any?
end
end
end
end
...
...
ee/app/services/ee/emails/create_service.rb
View file @
8df3f70c
module
EE
module
EE
module
Emails
module
Emails
module
CreateService
module
CreateService
include
EE
::
Emails
::
BaseService
include
::
EE
::
Emails
::
BaseService
def
execute
def
execute
email
=
super
email
=
super
...
...
ee/app/services/ee/emails/destroy_service.rb
View file @
8df3f70c
module
EE
module
EE
module
Emails
module
Emails
module
DestroyService
module
DestroyService
include
EE
::
Emails
::
BaseService
include
::
EE
::
Emails
::
BaseService
def
execute
def
execute
result
=
super
result
=
super
...
...
ee/app/services/ee/users/update_service.rb
View file @
8df3f70c
...
@@ -5,8 +5,8 @@ module EE
...
@@ -5,8 +5,8 @@ module EE
private
private
def
notify_success
def
notify_success
(
user_exists
)
notify_new_user
(
@user
,
nil
)
unless
@user
.
persisted?
notify_new_user
(
@user
,
nil
)
unless
user_exists
audit_changes
(
:email
,
as:
'email address'
)
audit_changes
(
:email
,
as:
'email address'
)
audit_changes
(
:encrypted_password
,
as:
'password'
,
skip_changes:
true
)
audit_changes
(
:encrypted_password
,
as:
'password'
,
skip_changes:
true
)
...
...
spec/features/login_spec.rb
View file @
8df3f70c
...
@@ -154,6 +154,8 @@ feature 'Login' do
...
@@ -154,6 +154,8 @@ feature 'Login' do
end
end
it
'creates a security event after failed OAuth login'
do
it
'creates a security event after failed OAuth login'
do
stub_licensed_features
(
extended_audit_events:
true
)
stub_omniauth_saml_config
(
enabled:
true
,
auto_link_saml_user:
true
,
allow_single_sign_on:
[
'saml'
],
providers:
[
mock_saml_config
])
stub_omniauth_saml_config
(
enabled:
true
,
auto_link_saml_user:
true
,
allow_single_sign_on:
[
'saml'
],
providers:
[
mock_saml_config
])
user
=
create
(
:omniauth_user
,
:two_factor
,
extern_uid:
'my-uid'
,
provider:
'saml'
)
user
=
create
(
:omniauth_user
,
:two_factor
,
extern_uid:
'my-uid'
,
provider:
'saml'
)
gitlab_sign_in_via
(
'saml'
,
user
,
'wrong-uid'
)
gitlab_sign_in_via
(
'saml'
,
user
,
'wrong-uid'
)
...
@@ -177,6 +179,8 @@ feature 'Login' do
...
@@ -177,6 +179,8 @@ feature 'Login' do
end
end
it
'blocks invalid login'
do
it
'blocks invalid login'
do
stub_licensed_features
(
extended_audit_events:
true
)
user
=
create
(
:user
,
password:
'not-the-default'
)
user
=
create
(
:user
,
password:
'not-the-default'
)
gitlab_sign_in
(
user
)
gitlab_sign_in
(
user
)
...
...
spec/lib/ee/audit/changes_spec.rb
View file @
8df3f70c
...
@@ -6,8 +6,11 @@ describe EE::Audit::Changes do
...
@@ -6,8 +6,11 @@ describe EE::Audit::Changes do
let
(
:foo_instance
)
{
Class
.
new
{
include
EE
::
Audit
::
Changes
}.
new
}
let
(
:foo_instance
)
{
Class
.
new
{
include
EE
::
Audit
::
Changes
}.
new
}
before
do
before
do
stub_licensed_features
(
extended_audit_events:
true
)
foo_instance
.
instance_variable_set
(
:@current_user
,
user
)
foo_instance
.
instance_variable_set
(
:@current_user
,
user
)
foo_instance
.
instance_variable_set
(
:@user
,
user
)
foo_instance
.
instance_variable_set
(
:@user
,
user
)
allow
(
foo_instance
).
to
receive
(
:model
).
and_return
(
user
)
allow
(
foo_instance
).
to
receive
(
:model
).
and_return
(
user
)
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