mirror of https://gitee.com/topiam/eiam
⚡ 优化代码
parent
cc804d0d2e
commit
7720cc377d
|
@ -45,6 +45,7 @@ import QiNiu from './QiNiu';
|
||||||
import Tencent from './Tencent';
|
import Tencent from './Tencent';
|
||||||
import { Container } from '@/components/Container';
|
import { Container } from '@/components/Container';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
|
import { SmsTemplateList } from '@/pages/setting/Message/data';
|
||||||
|
|
||||||
const layout = {
|
const layout = {
|
||||||
labelCol: {
|
labelCol: {
|
||||||
|
@ -130,7 +131,7 @@ const TestModal = (props: {
|
||||||
};
|
};
|
||||||
export default (props: { visible: boolean }) => {
|
export default (props: { visible: boolean }) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const editorFormRef = useRef<EditableFormInstance<SettingAPI.SmsTemplateList>>();
|
const editorFormRef = useRef<EditableFormInstance<SmsTemplateList>>();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { message, modal } = App.useApp();
|
const { message, modal } = App.useApp();
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
|
@ -144,7 +145,7 @@ export default (props: { visible: boolean }) => {
|
||||||
const [enabled, setEnabled] = useState<boolean>(false);
|
const [enabled, setEnabled] = useState<boolean>(false);
|
||||||
const [language, setLanguage] = useState<string>(Language.ZH);
|
const [language, setLanguage] = useState<string>(Language.ZH);
|
||||||
const [editableKeys, setEditableRowKeys] = useState<React.Key[]>();
|
const [editableKeys, setEditableRowKeys] = useState<React.Key[]>();
|
||||||
const [smsTemplateList, setSmsTemplateList] = useState<SettingAPI.SmsTemplateList[]>();
|
const [smsTemplateList, setSmsTemplateList] = useState<SmsTemplateList[]>();
|
||||||
|
|
||||||
const columns: ProColumns[] = [
|
const columns: ProColumns[] = [
|
||||||
{
|
{
|
||||||
|
@ -380,7 +381,7 @@ export default (props: { visible: boolean }) => {
|
||||||
label={intl.formatMessage({ id: 'pages.setting.message.sms_provider.provider' })}
|
label={intl.formatMessage({ id: 'pages.setting.message.sms_provider.provider' })}
|
||||||
rules={[{ required: true }]}
|
rules={[{ required: true }]}
|
||||||
fieldProps={{
|
fieldProps={{
|
||||||
onChange: async (value) => {
|
onChange: async (value: string) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setProvider(value);
|
setProvider(value);
|
||||||
//清理
|
//清理
|
||||||
|
|
|
@ -422,28 +422,4 @@ declare namespace AppAPI {
|
||||||
template: string;
|
template: string;
|
||||||
remark: string;
|
remark: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用信息
|
|
||||||
*/
|
|
||||||
export type GetApp = {
|
|
||||||
id: string;
|
|
||||||
type: string;
|
|
||||||
name: string;
|
|
||||||
icon: string;
|
|
||||||
template: string;
|
|
||||||
protocol: string;
|
|
||||||
protocolName: string;
|
|
||||||
clientId: string;
|
|
||||||
clientSecret: string;
|
|
||||||
//sso发起方
|
|
||||||
initLoginType: string;
|
|
||||||
//sso登录链接
|
|
||||||
initLoginUrl: string;
|
|
||||||
nameIdValueType: string;
|
|
||||||
//授权范围
|
|
||||||
authorizationType: string;
|
|
||||||
enabled: boolean;
|
|
||||||
remark: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,9 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
import { request } from '@umijs/max';
|
import { request } from '@umijs/max';
|
||||||
import type { LoginConfig, LoginParamsType, MfaFactor } from './data.d';
|
import type { LoginConfig, LoginParamsType } from './data.d';
|
||||||
import { stringify } from 'querystring';
|
import { stringify } from 'querystring';
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取 Mfa 因素
|
|
||||||
*/
|
|
||||||
export async function getMfaFactors(): Promise<API.ApiResult<MfaFactor>> {
|
|
||||||
return request('/api/v1/login/mfa/factors');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 账户登录
|
* 账户登录
|
||||||
*
|
*
|
||||||
|
@ -74,32 +67,6 @@ export async function sendLoginCaptchaOpt(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送MFA短信验证码
|
|
||||||
*/
|
|
||||||
export async function sendMfaSmsOtp(): Promise<API.ApiResult<boolean>> {
|
|
||||||
return request(`/api/v1/login/mfa/send`, {
|
|
||||||
method: 'POST',
|
|
||||||
data: stringify({ channel: 'sms' }),
|
|
||||||
skipErrorHandler: true,
|
|
||||||
}).catch((e) => {
|
|
||||||
throw e;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送MFA邮件验证码
|
|
||||||
*/
|
|
||||||
export async function sendMfaEmailOtp(): Promise<API.ApiResult<boolean>> {
|
|
||||||
return request(`/api/v1/login/mfa/send`, {
|
|
||||||
method: 'POST',
|
|
||||||
data: stringify({ channel: 'mail' }),
|
|
||||||
skipErrorHandler: true,
|
|
||||||
}).catch((e) => {
|
|
||||||
throw e;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取钉钉授权URL
|
* 获取钉钉授权URL
|
||||||
*
|
*
|
||||||
|
@ -115,22 +82,6 @@ export async function getDingtalkAuthorizeUrl(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取钉钉授权URL
|
|
||||||
*
|
|
||||||
* @param params
|
|
||||||
*/
|
|
||||||
export async function loginMfaValidate(
|
|
||||||
params: Record<string, any>,
|
|
||||||
): Promise<API.ApiResult<string>> {
|
|
||||||
return request(`/api/v1/login/mfa/validate`, {
|
|
||||||
params: params,
|
|
||||||
skipErrorHandler: true,
|
|
||||||
}).catch(({ response: { data } }) => {
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Idp绑定用户
|
* Idp绑定用户
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue