Skip to content

Commit

Permalink
[feature](System/OAuth): add email and wechat fields
Browse files Browse the repository at this point in the history
  • Loading branch information
zzyangh committed Jan 11, 2024
1 parent 9e7a17c commit 4b7f7d7
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 6 deletions.
10 changes: 8 additions & 2 deletions packages/base/src/locale/en-US/dmsSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,15 @@ export default {
accessTokenKeyNameTips:
'sqle会在获取用户ID时将access_token放在这个key对应的value中, 此参数会作为get请求的参数发送给用户ID获取地址',

userIdKeyName: 'user_id Key名称',
userIdKeyName: '用户UID的JSON路径',
userIdKeyNameTips:
'sqle会尝试使用此key从第三方平台的响应中解析出用户ID,用户ID应当为唯一ID',
'sqle会尝试使用此路径,从第三方平台获取用户信息的响应中解析出用户ID,用户ID应当为唯一ID',
userEmailTagName: '用户邮箱的JSON路径',
userEmailTagNameTips:
'sqle会尝试使用此路径,从第三方平台获取用户信息的响应中解析出用户邮箱',
userWechatTagName: '用户微信ID的JSON路径',
userWechatTagNameTips:
'sqle会尝试使用此路径,从第三方平台获取用户信息的响应中解析出用户微信ID',

loginButtonText: '登录按钮文字',
loginButtonTextTips: 'login页面oauth登录按钮文字',
Expand Down
10 changes: 8 additions & 2 deletions packages/base/src/locale/zh-CN/dmsSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,15 @@ export default {
accessTokenKeyNameTips:
'sqle会在获取用户ID时将access_token放在这个key对应的value中, 此参数会作为get请求的参数发送给用户ID获取地址',

userIdKeyName: 'user_id Key名称',
userIdKeyName: '用户UID的JSON路径',
userIdKeyNameTips:
'sqle会尝试使用此key从第三方平台的响应中解析出用户ID,用户ID应当为唯一ID',
'sqle会尝试使用此路径,从第三方平台获取用户信息的响应中解析出用户ID,用户ID应当为唯一ID',
userEmailTagName: '用户邮箱的JSON路径',
userEmailTagNameTips:
'sqle会尝试使用此路径,从第三方平台获取用户信息的响应中解析出用户邮箱',
userWechatTagName: '用户微信ID的JSON路径',
userWechatTagNameTips:
'sqle会尝试使用此路径,从第三方平台获取用户信息的响应中解析出用户微信ID',

loginButtonText: '登录按钮文字',
loginButtonTextTips: 'login页面oauth登录按钮文字',
Expand Down
58 changes: 56 additions & 2 deletions packages/base/src/page/System/LoginConnection/Oauth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ const Oauth = () => {
server_user_id_url: value.serverUserIdUrl,
access_token_tag: value.accessTokenKeyName,
login_tip: value.loginButtonText,
user_id_tag: value.userIdKeyName
user_id_tag: value.userIdKeyName,
user_email_tag: value.userEmailTag,
user_wechat_tag: value.userWechatTag
};

Check warning on line 103 in packages/base/src/page/System/LoginConnection/Oauth/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

if (!!value.scopes) {
Expand Down Expand Up @@ -131,7 +133,9 @@ const Oauth = () => {
scopes: oauthConfig?.scopes?.join(','),
accessTokenKeyName: oauthConfig?.access_token_tag,
loginButtonText: oauthConfig?.login_tip,
userIdKeyName: oauthConfig?.user_id_tag
userIdKeyName: oauthConfig?.user_id_tag,
userEmailTag: oauthConfig?.user_email_tag,
userWechatTag: oauthConfig?.user_wechat_tag
});

Check warning on line 139 in packages/base/src/page/System/LoginConnection/Oauth/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement
}, [form, oauthConfig]);

Check warning on line 140 in packages/base/src/page/System/LoginConnection/Oauth/index.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🧾 Statement is not covered

Warning! Not covered statement

Expand Down Expand Up @@ -244,6 +248,32 @@ const Oauth = () => {
dataIndex: 'user_id_tag',
hidden: !oauthConfig?.enable_oauth2
},
{
label: (
<BasicToolTips
title={t('dmsSystem.oauth.userEmailTagNameTips')}
suffixIcon={<IconTipGray />}
>
{t('dmsSystem.oauth.userEmailTagName')}
</BasicToolTips>
),
span: 3,
dataIndex: 'user_email_tag',
hidden: !oauthConfig?.enable_oauth2
},
{
label: (
<BasicToolTips
title={t('dmsSystem.oauth.userWechatTagNameTips')}
suffixIcon={<IconTipGray />}
>
{t('dmsSystem.oauth.userWechatTagName')}
</BasicToolTips>
),
span: 3,
dataIndex: 'user_wechat_tag',
hidden: !oauthConfig?.enable_oauth2
},
{
label: (
<BasicToolTips
Expand Down Expand Up @@ -459,6 +489,30 @@ const Oauth = () => {
>
<BasicInput />
</FormItemLabel>
<FormItemLabel
className="has-label-tip"
label={
<CustomLabelContent
title={t('dmsSystem.oauth.userEmailTagName')}
tips={t('dmsSystem.oauth.userEmailTagNameTips')}
/>
}
name="userEmailTag"
>
<BasicInput />
</FormItemLabel>
<FormItemLabel
className="has-label-tip"
label={
<CustomLabelContent
title={t('dmsSystem.oauth.userWechatTagName')}
tips={t('dmsSystem.oauth.userWechatTagNameTips')}
/>
}
name="userWechatTag"
>
<BasicInput />
</FormItemLabel>
<FormItemLabel
className="has-label-tip"
label={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ export type OauthFormField = {
accessTokenKeyName: string;
userIdKeyName: string;
loginButtonText: string;
userEmailTag: string;
userWechatTag: string;
};
8 changes: 8 additions & 0 deletions packages/shared/lib/api/base/service/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ export interface IGetOauth2ConfigurationResData {
server_user_id_url?: string;

user_id_tag?: string;

user_email_tag?: string;

user_wechat_tag?: string;
}

export interface IGetOauth2ConfigurationResDataReply {
Expand Down Expand Up @@ -946,6 +950,10 @@ export interface IOauth2Configuration {
server_user_id_url?: string;

user_id_tag?: string;

user_email_tag?: string;

user_wechat_tag?: string;
}

export interface IOpPermissionItem {
Expand Down

0 comments on commit 4b7f7d7

Please sign in to comment.