Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
47ce264f
Commit
47ce264f
authored
Jun 28, 2016
by
Eric Chiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
return 409 status code on duplicate email errors
parent
bdaded57
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
3 deletions
+21
-3
api.go
admin/api.go
+1
-1
admin_api_test.go
integration/admin_api_test.go
+1
-1
user_api_test.go
integration/user_api_test.go
+18
-0
api.go
user/api/api.go
+1
-1
No files found.
admin/api.go
View file @
47ce264f
...
...
@@ -81,7 +81,7 @@ var (
client
.
ErrorInvalidClientSecret
:
errorMaker
(
"bad_request"
,
"Secret must be a base64 encoded string"
,
http
.
StatusBadRequest
),
user
.
ErrorNotFound
:
errorMaker
(
"resource_not_found"
,
"Resource could not be found."
,
http
.
StatusNotFound
),
user
.
ErrorDuplicateEmail
:
errorMaker
(
"bad_request"
,
"Email already in use."
,
http
.
Status
BadReques
t
),
user
.
ErrorDuplicateEmail
:
errorMaker
(
"bad_request"
,
"Email already in use."
,
http
.
Status
Conflic
t
),
user
.
ErrorInvalidEmail
:
errorMaker
(
"bad_request"
,
"invalid email."
,
http
.
StatusBadRequest
),
adminschema
.
ErrorInvalidRedirectURI
:
errorMaker
(
"bad_request"
,
"invalid redirectURI."
,
http
.
StatusBadRequest
),
...
...
integration/admin_api_test.go
View file @
47ce264f
...
...
@@ -201,7 +201,7 @@ func TestCreateAdmin(t *testing.T) {
Email
:
"Email-1@example.com"
,
Password
:
"foopass"
,
},
errCode
:
http
.
Status
BadReques
t
,
errCode
:
http
.
Status
Conflic
t
,
},
{
// missing Email
...
...
integration/user_api_test.go
View file @
47ce264f
...
...
@@ -409,6 +409,24 @@ func TestCreateUser(t *testing.T) {
},
},
},
{
// Duplicate email
req
:
schema
.
UserCreateRequest
{
User
:
&
schema
.
User
{
Email
:
"Email-1@example.com"
,
DisplayName
:
"New User"
,
EmailVerified
:
true
,
Admin
:
false
,
CreatedAt
:
clock
.
Now
()
.
Format
(
time
.
RFC3339
),
},
RedirectURL
:
testRedirectURL
.
String
(),
},
token
:
userGoodToken
,
wantCode
:
http
.
StatusConflict
,
},
{
req
:
schema
.
UserCreateRequest
{
...
...
user/api/api.go
View file @
47ce264f
...
...
@@ -31,7 +31,7 @@ var (
ErrorInvalidClient
=
newError
(
"invalid_client"
,
"invalid email."
,
http
.
StatusBadRequest
)
ErrorDuplicateEmail
=
newError
(
"duplicate_email"
,
"Email already in use."
,
http
.
Status
BadReques
t
)
ErrorDuplicateEmail
=
newError
(
"duplicate_email"
,
"Email already in use."
,
http
.
Status
Conflic
t
)
ErrorResourceNotFound
=
newError
(
"resource_not_found"
,
"Resource could not be found."
,
http
.
StatusNotFound
)
ErrorUnauthorized
=
newError
(
"unauthorized"
,
"Necessary credentials not provided."
,
http
.
StatusUnauthorized
)
...
...
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