Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit 8e7b2e5

Browse files
author
noah
committed
fix: Log error for signin
1 parent aa6555c commit 8e7b2e5

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cmd/server/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type (
4242
Github struct {
4343
GithubClientID string `split_words:"true"`
4444
GithubClientSecret string `split_words:"true"`
45-
GithubScopes []string `split_words:"true" default:"repo"`
45+
GithubScopes []string `split_words:"true" default:"repo,read:user,read:org"`
4646
}
4747

4848
Slack struct {

internal/server/web/index.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,21 @@ func (w *Web) Signin(c *gin.Context) {
148148
return
149149
}
150150

151-
u, _ = w.i.CreateUser(ctx, u)
151+
if u, err = w.i.CreateUser(ctx, u); err != nil {
152+
w.log.Error("It has failed to save a new user.", zap.Error(err))
153+
c.String(http.StatusInternalServerError, "It has failed to save a new user.")
154+
return
155+
}
152156
} else if err != nil {
153-
w.log.Error("It failed to save the user.", zap.Error(err))
154-
c.String(http.StatusInternalServerError, "It has failed to save the user.")
157+
w.log.Error("It failed to find the user.", zap.Error(err))
158+
c.String(http.StatusInternalServerError, "It has failed to find the user.")
155159
return
156160
} else {
157-
u, _ = w.i.UpdateUser(ctx, u)
161+
if u, _ = w.i.UpdateUser(ctx, u); err != nil {
162+
w.log.Error("It has failed to update the user.", zap.Error(err))
163+
c.String(http.StatusInternalServerError, "It has failed to update the user.")
164+
return
165+
}
158166
}
159167

160168
// Register cookie.

0 commit comments

Comments
 (0)