feat: support github login (#2639)

* Support Github Login

* improve according to codefactor

* fix due to last updates

* optimization

Co-authored-by: Noah Hsu <i@nn.ci>
This commit is contained in:
itsHenry
2022-12-27 22:11:22 +08:00
committed by GitHub
parent c00dcc8f39
commit 83fe17c6ec
8 changed files with 125 additions and 1 deletions

View File

@ -91,7 +91,7 @@ func CurrentUser(c *gin.Context) {
}
func UpdateCurrent(c *gin.Context) {
var req LoginReq
var req model.User
if err := c.ShouldBind(&req); err != nil {
common.ErrorResp(c, err, 400)
return
@ -101,6 +101,7 @@ func UpdateCurrent(c *gin.Context) {
if req.Password != "" {
user.Password = req.Password
}
user.GithubID = req.GithubID
if err := op.UpdateUser(user); err != nil {
common.ErrorResp(c, err, 500)
} else {