Skip to content

Commit

Permalink
Fix GitHub OAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
slhmy committed Oct 1, 2024
1 parent 1035ddc commit db89ff0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cmd/web_server/handler/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,16 @@ func githubCallback(ginCtx *gin.Context) {
}
var user *user_model.User
if total <= 0 {
uuid := uuid.New()
user, err = user_service.CreateUser(ginCtx, user_model.User{
Account: uuid.String(),
creatingUser := user_model.User{
Account: uuid.New().String(),
Name: githubUser.Name,
Email: &githubUser.Email,
AvatarURL: githubUser.AvatarURL,
GithubLogin: &githubUser.Login,
})
}
if len(githubUser.Email) > 0 {
creatingUser.Email = &githubUser.Email
}
user, err = user_service.CreateUser(ginCtx, creatingUser)
if err != nil {
gin_utils.NewInternalError(ginCtx, fmt.Sprintf("failed to create user: %v", err))
return
Expand Down

0 comments on commit db89ff0

Please sign in to comment.