Skip to content

Commit

Permalink
fix: 第三方登录注销 #500
Browse files Browse the repository at this point in the history
  • Loading branch information
Calcium-Ion committed Sep 25, 2024
1 parent 972ac1e commit 9fe1f35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions controller/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/sha256"
"encoding/hex"
"io"
"net/http"
"one-api/common"
"one-api/model"
"sort"
Expand Down Expand Up @@ -48,6 +49,13 @@ func TelegramBind(c *gin.Context) {
})
return
}
if user.Id == 0 {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "用户已注销",
})
return
}
user.TelegramId = telegramId
if err := user.Update(false); err != nil {
c.JSON(200, gin.H{
Expand Down
7 changes: 7 additions & 0 deletions controller/wechat.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ func WeChatAuth(c *gin.Context) {
})
return
}
if user.Id == 0 {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "用户已注销",
})
return
}
} else {
if common.RegisterEnabled {
user.Username = "wechat_" + strconv.Itoa(model.GetMaxUserId()+1)
Expand Down

0 comments on commit 9fe1f35

Please # to comment.