Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a9c03e

Browse files
committed
updated
1 parent59a380c commit0a9c03e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎controllers/auth.controller.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,10 @@ func (ac *AuthController) SignUpUser(ctx *gin.Context) {
5656

5757
result:=ac.DB.Create(&newUser)
5858

59-
ifresult.Error!=nil {
60-
ifstrings.Contains(result.Error.Error(),"duplicate key") {
61-
ctx.JSON(http.StatusConflict, gin.H{"status":"fail","message":"User with that email already exists"})
62-
return
63-
}
59+
ifresult.Error!=nil&&strings.Contains(result.Error.Error(),"duplicate key value violates unique") {
60+
ctx.JSON(http.StatusConflict, gin.H{"status":"fail","message":"User with that email already exists"})
61+
return
62+
}elseifresult.Error!=nil {
6463
ctx.JSON(http.StatusBadGateway, gin.H{"status":"error","message":"Something bad happened"})
6564
return
6665
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp