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
c2bc15a7
Commit
c2bc15a7
authored
May 20, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the authentication_token for finding the user
parent
a7f6b75e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
lib/gitlab/email/handler/create_issue.rb
lib/gitlab/email/handler/create_issue.rb
+1
-10
spec/lib/gitlab/email/receiver_spec.rb
spec/lib/gitlab/email/receiver_spec.rb
+3
-3
No files found.
lib/gitlab/email/handler/create_issue.rb
View file @
c2bc15a7
...
...
@@ -11,7 +11,6 @@ module Gitlab
def
execute
validate_permission!
(
:create_issue
)
validate_authentication_token!
verify_record
(
create_issue
,
...
...
@@ -21,10 +20,7 @@ module Gitlab
end
def
author
@author
||=
mail
.
from
.
find
do
|
email
|
user
=
User
.
find_by_any_email
(
email
)
break
user
if
user
end
@author
||=
User
.
find_by
(
authentication_token:
authentication_token
)
end
def
project
...
...
@@ -48,11 +44,6 @@ module Gitlab
description:
message
).
execute
end
def
validate_authentication_token!
raise
UserNotAuthorizedError
unless
author
.
authentication_token
==
authentication_token
end
end
end
end
...
...
spec/lib/gitlab/email/receiver_spec.rb
View file @
c2bc15a7
...
...
@@ -224,11 +224,11 @@ describe Gitlab::Email::Receiver, lib: true do
end
end
context
"when
the authentication_token token didn't match
"
do
context
"when
we can't find the authentication_token
"
do
let!
(
:email_raw
)
{
fixture_file
(
"emails/wrong_authentication_token.eml"
)
}
it
"raises an UserNot
Authorize
dError"
do
expect
{
receiver
.
execute
}.
to
raise_error
(
Gitlab
::
Email
::
UserNot
Authorize
dError
)
it
"raises an UserNot
Foun
dError"
do
expect
{
receiver
.
execute
}.
to
raise_error
(
Gitlab
::
Email
::
UserNot
Foun
dError
)
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