feat(plugin): external user login add access token

This commit is contained in:
LinkinStar 2023-01-10 14:24:32 +08:00
parent fe6a53fb62
commit 8575bbf8c8
6 changed files with 17 additions and 3 deletions

View File

@ -5723,6 +5723,9 @@ const docTemplate = `{
"schema.ExternalLoginBindingUserSendEmailResp": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"email_exist_and_must_be_confirmed": {
"type": "boolean"
}

View File

@ -5711,6 +5711,9 @@
"schema.ExternalLoginBindingUserSendEmailResp": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"email_exist_and_must_be_confirmed": {
"type": "boolean"
}

View File

@ -312,6 +312,8 @@ definitions:
type: object
schema.ExternalLoginBindingUserSendEmailResp:
properties:
access_token:
type: string
email_exist_and_must_be_confirmed:
type: boolean
type: object

View File

@ -76,8 +76,8 @@ func (cc *ConnectorController) ConnectorRedirect(connector plugin.Connector) (fn
Provider: connector.ConnectorSlugName(),
ExternalID: userInfo.ExternalID,
Name: userInfo.Name,
Email: userInfo.Email,
MetaInfo: userInfo.MetaInfo,
//Email: userInfo.Email,
MetaInfo: userInfo.MetaInfo,
}
resp, err := cc.userExternalService.ExternalLogin(ctx, u)
if err != nil {

View File

@ -17,7 +17,8 @@ type ExternalLoginBindingUserSendEmailReq struct {
// ExternalLoginBindingUserSendEmailResp external login binding user response
type ExternalLoginBindingUserSendEmailResp struct {
EmailExistAndMustBeConfirmed bool `json:"email_exist_and_must_be_confirmed"`
EmailExistAndMustBeConfirmed bool `json:"email_exist_and_must_be_confirmed"`
AccessToken string `json:"access_token"`
}
// ExternalLoginBindingUserReq external login binding user request

View File

@ -180,6 +180,11 @@ func (us *UserExternalLoginService) ExternalLoginBindingUserSendEmail(
if err != nil {
return nil, err
}
resp.AccessToken, _, err = us.userCommonService.CacheLoginUserInfo(
ctx, userInfo.ID, userInfo.MailStatus, userInfo.Status)
if err != nil {
log.Error(err)
}
}
err = us.userExternalLoginRepo.SetCacheUserExternalLoginInfo(ctx, req.BindingKey, externalLoginInfo)
if err != nil {