mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-11-10 02:23:43 +08:00
Merge branch 'upstream/main'
This commit is contained in:
@@ -80,6 +80,7 @@ func getLarkUserInfoByCode(code string) (*LarkUser, error) {
|
||||
}
|
||||
|
||||
func LarkOAuth(c *gin.Context) {
|
||||
ctx := c.Request.Context()
|
||||
session := sessions.Default(c)
|
||||
state := c.Query("state")
|
||||
if state == "" || session.Get("oauth_state") == nil || state != session.Get("oauth_state").(string) {
|
||||
@@ -126,7 +127,7 @@ func LarkOAuth(c *gin.Context) {
|
||||
user.Role = model.RoleCommonUser
|
||||
user.Status = model.UserStatusEnabled
|
||||
|
||||
if err := user.Insert(0); err != nil {
|
||||
if err := user.Insert(ctx, 0); err != nil {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": false,
|
||||
"message": err.Error(),
|
||||
|
||||
Reference in New Issue
Block a user