From 111d1a578659279e826e6999cc2b640a66df7752 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sat, 23 Sep 2023 00:13:13 +0800 Subject: [PATCH] Use UserInfo's ID in OAuth login --- controllers/auth.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/auth.go b/controllers/auth.go index 3c0cd256..5bf4fcb9 100644 --- a/controllers/auth.go +++ b/controllers/auth.go @@ -615,11 +615,16 @@ func (c *ApiController) Login() { return } + userId := userInfo.Id + if userId == "" { + userId = util.GenerateId() + } + user = &object.User{ Owner: application.Organization, Name: userInfo.Username, CreatedTime: util.GetCurrentTime(), - Id: util.GenerateId(), + Id: userId, Type: "normal-user", DisplayName: userInfo.DisplayName, Avatar: userInfo.AvatarUrl,