Skip to content

Commit

Permalink
Merge branch 'dev-4.2.4' of https://code.alipay.com/oceanbase/oceanba…
Browse files Browse the repository at this point in the history
…se-developer-center into dev-4.2.4
  • Loading branch information
HSunboy committed Feb 29, 2024
2 parents 3e83230 + d671800 commit c4416ae
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 14 deletions.
4 changes: 3 additions & 1 deletion src/component/Task/AsyncTask/DetailContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ const AsyncTaskContent: React.FC<IProps> = (props) => {
)}
</div>
{result?.autoModifyTimeout && (
<Tooltip title="变更语句中包含索引变更,可能耗时较久,已将您的变更工单超时时间调整为 48 小时">
<Tooltip
title={`变更语句中包含索引变更,可能耗时较久,已将您的变更工单超时时间调整为 ${executionTimeout} 小时`}
>
<div
style={{
display: 'flex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
IUserInfoAuthenticationMethod,
} from '@/d.ts';
import { formatMessage } from '@/util/intl';
import { Form, Input, Select, Space, Switch, Typography } from 'antd';
import { Form, Input, InputNumber, Select, Space, Switch, Typography } from 'antd';
import React from 'react';
import HelpDoc from '@/component/helpDoc';
import { requiredRule } from '.';
Expand Down Expand Up @@ -503,6 +503,50 @@ export const LDAPPartForm: React.FC<{
]}
/>
</Form.Item>
<Form.Item
name={['ssoParameter', 'loginFailedLimit']}
label={
<HelpDoc leftText title="设置为0表示不设置最大连续登录失败次数">
loginFailedLimit
</HelpDoc>
}
rules={[
{
...requiredRule,
message: '请输入最大连续登录失败次数',
},
]}
initialValue={5}
>
<InputNumber
style={{ width: '200px' }}
min={0}
placeholder={'最大连续登录失败次数'}
addonAfter="次"
/>
</Form.Item>
<Form.Item
name={['ssoParameter', 'lockTimeSeconds']}
label={
<HelpDoc leftText title="多少秒后重置登录次数">
lockTimeSeconds
</HelpDoc>
}
rules={[
{
...requiredRule,
message: '请输入登录次数重置时间',
},
]}
initialValue={600}
>
<InputNumber
style={{ width: '200px' }}
min={0}
placeholder={'登录次数重置时间'}
addonAfter="秒"
/>
</Form.Item>
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ export default inject('userStore')(
['ssoParameter', 'groupSearchBase'],
['ssoParameter', 'groupSearchFilter'],
['ssoParameter', 'groupSearchSubtree'],
['ssoParameter', 'loginFailedLimit'],
['ssoParameter', 'lockTimeSeconds'],
['mappingRule', 'userProfileViewType'],
['mappingRule', 'nestedAttributeField'],
])
Expand Down
46 changes: 34 additions & 12 deletions src/page/Login/components/LDAPModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { UserStore } from '@/store/login';
import channel, { ChannelMap } from '@/util/broadcastChannel';
import { formatMessage, getLocalImg } from '@/util/intl';
import { LockOutlined, UserOutlined } from '@ant-design/icons';
import { Button, Divider, Form, Input, message } from 'antd';
import { Alert, Button, Divider, Form, Input, message } from 'antd';
import useForm from 'antd/lib/form/hooks/useForm';
import classNames from 'classnames';
import { inject, observer } from 'mobx-react';
Expand Down Expand Up @@ -45,6 +45,7 @@ export const LDAPLogin: React.FC<{
mode: ELDAPMode;
data: ISSOConfig;
}>();
const [errorMessage, setErrorMessage] = useState<string>(null);
const handleTest = async () => {
const data = await form.validateFields().catch();
if (isSubmiting) {
Expand All @@ -64,13 +65,14 @@ export const LDAPLogin: React.FC<{
});
if (!result?.successful) {
setIsSubmiting(false);
return message.error(result?.errMsg || '测试登录失败!');
setErrorMessage(result?.errMsg);
} else {
channel.send(ChannelMap.LDAP_TEST, {
isSuccess: true,
testId: res.testId,
});
setIsSubmiting(false);
setErrorMessage(null);
}
};
const handleLogin = async () => {
Expand All @@ -83,8 +85,10 @@ export const LDAPLogin: React.FC<{
username: data?.username,
password: data?.password,
});
console.log(result);
if (result?.successful) {
message.success(formatMessage({ id: 'login.login.success' }));
setErrorMessage(null);
await userStore.getOrganizations();
const isSuccess = await userStore.switchCurrentOrganization();
if (!isSuccess) {
Expand All @@ -104,7 +108,7 @@ export const LDAPLogin: React.FC<{
toDefaultProjectPage();
}
} else {
message.error('LDAP 登录失败,请检查输入项是否正确!');
setErrorMessage(result?.errMsg);
console.error(result);
}
setIsSubmiting(false);
Expand Down Expand Up @@ -151,21 +155,39 @@ export const LDAPLogin: React.FC<{
handleTest={handleTest}
handleLogin={handleLogin}
/>
{errorMessage && (
<Alert
type="error"
showIcon={true}
className={`${prefix}-alert`}
message={errorMessage}
/>
)}
</div>
</div>
</div>
);
}
return (
<LDAPLoginContent
isSubmiting={isSubmiting}
isTest={isTest}
prefix={prefix}
form={form}
switchSSOLoginType={switchSSOLoginType}
handleTest={handleTest}
handleLogin={handleLogin}
/>
<>
<LDAPLoginContent
isSubmiting={isSubmiting}
isTest={isTest}
prefix={prefix}
form={form}
switchSSOLoginType={switchSSOLoginType}
handleTest={handleTest}
handleLogin={handleLogin}
/>
{errorMessage && (
<Alert
type="error"
showIcon={true}
className={`${prefix}-alert`}
message={errorMessage}
/>
)}
</>
);
}),
);
Expand Down

0 comments on commit c4416ae

Please sign in to comment.