Skip to content

Commit

Permalink
fix: github绑定失败
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjies committed Jul 17, 2024
1 parent d7de9e9 commit 2c5443d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 4 additions & 2 deletions internal/app/assets/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"AddressAlreadyLinkedEmail": "The wallet address has already been linked to Email. Please do not repeat the operation.",
"EmailAlreadyLinked": "The email has already been linked to another address!",
"GithubAlreadyLinked": "Github has been linked to another wallet address!",
"AddressAlreadyLinkedGithub": "The wallet address has already been linked to Github. Please do not repeat the operation."
"AddressAlreadyLinkedGithub": "The wallet address has already been linked to Github. Please do not repeat the operation.",
"FailedObtainGithubInfo": "Failed to obtain Github information!"
},
"zh-CN": {
"OperationSuccess": "操作成功!",
Expand Down Expand Up @@ -77,6 +78,7 @@
"AddressAlreadyLinkedEmail": "钱包地址已绑定邮箱,请勿重复操作",
"EmailAlreadyLinked": "邮箱已绑定其他钱包地址",
"GithubAlreadyLinked": "Github 已绑定其他钱包地址",
"AddressAlreadyLinkedGithub": "钱包地址已绑定Github,请勿重复操作"
"AddressAlreadyLinkedGithub": "钱包地址已绑定Github,请勿重复操作",
"FailedObtainGithubInfo": "绑定 Github 信息失败!"
}
}
12 changes: 12 additions & 0 deletions internal/app/dao/social.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ func (d *Dao) WechatIsBinding(fromUserName string) (string, bool, error) {
}
return "", false, err
}
if address == "" {
return "", false, nil
}
return address, true, nil
}

Expand Down Expand Up @@ -113,6 +116,9 @@ func (d *Dao) DiscordIsBinding(discordID string) (string, bool, error) {
}
return "", false, err
}
if address == "" {
return "", false, nil
}
return address, true, nil
}

Expand All @@ -126,6 +132,9 @@ func (d *Dao) EmailIsBinding(email string) (string, bool, error) {
}
return "", false, err
}
if address == "" {
return "", false, nil
}
return address, true, nil
}

Expand Down Expand Up @@ -202,6 +211,9 @@ func (d *Dao) GithubIsBinding(githubID string) (string, bool, error) {
}
return "", false, err
}
if address == "" {
return "", false, nil
}
return address, true, nil
}

Expand Down
2 changes: 1 addition & 1 deletion internal/auth/service/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ func (s *Service) GithubCallback(code, callback string) (id, username string, er
return
}
id = gjson.Get(res.String(), "id").String()
username = gjson.Get(res.String(), "name").String()
username = gjson.Get(res.String(), "login").String()
return id, username, err
}

0 comments on commit 2c5443d

Please sign in to comment.