邮箱登录添加mockSend
This commit is contained in:
parent
9471c129be
commit
ac236b78a4
|
|
@ -1360,7 +1360,7 @@ export async function sendCaptchaByMobile({ mobile, env, type: type2, }, context
|
|||
}
|
||||
const now = Date.now();
|
||||
const closeRootMode = context.openRootMode();
|
||||
if (process.env.NODE_ENV !== 'development' && !mockSend) {
|
||||
if (!mockSend) {
|
||||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
|
|
@ -1411,7 +1411,7 @@ export async function sendCaptchaByMobile({ mobile, env, type: type2, }, context
|
|||
});
|
||||
if (captcha) {
|
||||
const code = captcha.code;
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1437,7 +1437,7 @@ export async function sendCaptchaByMobile({ mobile, env, type: type2, }, context
|
|||
}
|
||||
else {
|
||||
let code;
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
code = mobile.substring(11 - digit);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1464,7 +1464,7 @@ export async function sendCaptchaByMobile({ mobile, env, type: type2, }, context
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1519,6 +1519,7 @@ export async function sendCaptchaByEmail({ email, env, type: type2, }, context)
|
|||
assert(emailConfig);
|
||||
const duration = config.codeDuration || 5;
|
||||
const digit = config.digit || 4;
|
||||
const mockSend = config.mockSend;
|
||||
let emailOptions = {
|
||||
host: emailConfig.host,
|
||||
port: emailConfig.port,
|
||||
|
|
@ -1532,7 +1533,7 @@ export async function sendCaptchaByEmail({ email, env, type: type2, }, context)
|
|||
};
|
||||
const now = Date.now();
|
||||
const closeRootMode = context.openRootMode();
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
if (!mockSend) {
|
||||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
|
|
@ -1583,7 +1584,7 @@ export async function sendCaptchaByEmail({ email, env, type: type2, }, context)
|
|||
});
|
||||
if (captcha) {
|
||||
const code = captcha.code;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1630,7 +1631,7 @@ export async function sendCaptchaByEmail({ email, env, type: type2, }, context)
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1844,8 +1845,8 @@ export async function refreshToken(params, context) {
|
|||
// 只有server模式去刷新token
|
||||
// 'development' | 'production' | 'staging'
|
||||
const intervals = {
|
||||
development: 7200 * 1000, // 2小时
|
||||
staging: 600 * 1000, // 十分钟
|
||||
development: 7200 * 1000,
|
||||
staging: 600 * 1000,
|
||||
production: 600 * 1000, // 十分钟
|
||||
};
|
||||
const application = context.getApplication();
|
||||
|
|
|
|||
|
|
@ -208,24 +208,26 @@ export default OakComponent({
|
|||
}
|
||||
break;
|
||||
case 'email':
|
||||
if (!pConfig.account || pConfig.account === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置账号',
|
||||
};
|
||||
}
|
||||
else if (!pConfig.subject || pConfig.subject === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件主题',
|
||||
};
|
||||
}
|
||||
else if ((!pConfig.text || pConfig.text === '' || !pConfig.text?.includes('${code}')) &&
|
||||
(!pConfig.html || pConfig.html === '' || !pConfig.html?.includes('${code}'))) {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件内容模板',
|
||||
};
|
||||
if (!pConfig.mockSend) {
|
||||
if (!pConfig.account || pConfig.account === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置账号',
|
||||
};
|
||||
}
|
||||
else if (!pConfig.subject || pConfig.subject === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件主题',
|
||||
};
|
||||
}
|
||||
else if ((!pConfig.text || pConfig.text === '' || !pConfig.text?.includes('${code}')) &&
|
||||
(!pConfig.html || pConfig.html === '' || !pConfig.html?.includes('${code}'))) {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件内容模板',
|
||||
};
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'wechatPublicForWeb':
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ export default function Email(props: {
|
|||
};
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}): React.JSX.Element;
|
||||
|
|
|
|||
|
|
@ -61,12 +61,17 @@ export default function Email(props) {
|
|||
{enabled &&
|
||||
<div>
|
||||
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} style={{ maxWidth: 900, marginTop: 16 }}>
|
||||
<Form.Item label="模拟发送" tooltip="开启模拟发送验证码,发邮件不会调用api">
|
||||
<Switch checkedChildren="是" unCheckedChildren="否" checked={config?.mockSend} onChange={(checked) => {
|
||||
updateConfig(id, config, 'mockSend', checked, 'email');
|
||||
}}/>
|
||||
</Form.Item>
|
||||
<Form.Item label="邮件主题">
|
||||
<Input placeholder="请输入邮件主题" type="text" value={subject} onChange={(e) => {
|
||||
setSubject(e.target.value);
|
||||
}} onBlur={() => {
|
||||
if (subject !== config?.subject) {
|
||||
updateConfig(id, config, 'subject', subject);
|
||||
updateConfig(id, config, 'subject', subject, 'email');
|
||||
}
|
||||
}}/>
|
||||
</Form.Item>
|
||||
|
|
@ -89,13 +94,13 @@ export default function Email(props) {
|
|||
setText(e.target.value);
|
||||
}} onBlur={() => {
|
||||
if (text !== config?.text) {
|
||||
updateConfig(id, config, 'text', text);
|
||||
updateConfig(id, config, 'text', text, 'email');
|
||||
}
|
||||
}}/>) : (<div style={{ border: '1px solid #ccc' }}>
|
||||
<Toolbar editor={editor} defaultConfig={toolbarConfig} mode="default" style={{ borderBottom: '1px solid #ccc' }}/>
|
||||
<Editor defaultConfig={editorConfig} value={html} onCreated={setEditor} onChange={editor => {
|
||||
setHtml(editor.getHtml());
|
||||
updateConfig(id, config, 'html', editor.getHtml());
|
||||
updateConfig(id, config, 'html', editor.getHtml(), 'email');
|
||||
}} mode="default" style={{ height: '260px', overflowY: 'hidden' }}/>
|
||||
</div>)}
|
||||
</>
|
||||
|
|
@ -111,10 +116,10 @@ export default function Email(props) {
|
|||
}
|
||||
}} onBlur={() => {
|
||||
if (Number(emailCodeDuration) > 0) {
|
||||
updateConfig(id, config, 'codeDuration', emailCodeDuration);
|
||||
updateConfig(id, config, 'codeDuration', emailCodeDuration, 'email');
|
||||
}
|
||||
else {
|
||||
updateConfig(id, config, 'codeDuration', undefined);
|
||||
updateConfig(id, config, 'codeDuration', undefined, 'email');
|
||||
}
|
||||
}} suffix="分钟"/>
|
||||
</Form.Item>
|
||||
|
|
@ -129,10 +134,10 @@ export default function Email(props) {
|
|||
}
|
||||
}} onBlur={() => {
|
||||
if (Number(emailDigit) > 0) {
|
||||
updateConfig(id, config, 'digit', emailDigit);
|
||||
updateConfig(id, config, 'digit', emailDigit, 'email');
|
||||
}
|
||||
else {
|
||||
updateConfig(id, config, 'digit', undefined);
|
||||
updateConfig(id, config, 'digit', undefined, 'email');
|
||||
}
|
||||
}}/>
|
||||
</Form.Item>
|
||||
|
|
|
|||
|
|
@ -56,21 +56,44 @@ export default OakComponent({
|
|||
data: {},
|
||||
lifetimes: {},
|
||||
methods: {
|
||||
updateConfig(id, config, path, value) {
|
||||
updateConfig(id, config, path, value, type) {
|
||||
const newConfig = cloneDeep(config);
|
||||
set(newConfig, path, value);
|
||||
if (path === 'mockSend' && !value) {
|
||||
if (!newConfig.templateName || newConfig.templateName === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未配置模板名称,将无法正常使用短信登录'
|
||||
});
|
||||
if (type === 'sms') {
|
||||
if (!newConfig.templateName || newConfig.templateName === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未配置模板名称,将无法正常使用短信登录'
|
||||
});
|
||||
}
|
||||
else if (!newConfig.defaultOrigin) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未选择默认渠道,将无法正常使用短信登录'
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (!newConfig.defaultOrigin) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未选择默认渠道,将无法正常使用短信登录'
|
||||
});
|
||||
else if (type === 'email') {
|
||||
if (!newConfig.account || newConfig.account === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '邮箱登录未指定邮箱账号,将无法正常使用短信登录'
|
||||
});
|
||||
}
|
||||
else if (!newConfig.subject || newConfig.subject === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '邮箱登录未配置邮件主题,将无法正常使用短信登录'
|
||||
});
|
||||
}
|
||||
else if ((!newConfig.text || newConfig.text === '' || !newConfig.text?.includes('${code}')) &&
|
||||
(!newConfig.html || newConfig.html === '' || !newConfig.html?.includes('${code}'))) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '邮箱登录未配置邮件内容模板,将无法正常使用短信登录'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (path === 'appId' && (!value || value === '')) {
|
||||
|
|
@ -116,38 +139,40 @@ export default OakComponent({
|
|||
}
|
||||
break;
|
||||
case 'email':
|
||||
if (!config.account || config.account === '') {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未指定邮箱账号',
|
||||
});
|
||||
}
|
||||
else if (!config.subject || config.subject === '') {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件主题' });
|
||||
}
|
||||
else {
|
||||
if (!config.mockSend) {
|
||||
if (!config.account || config.account === '') {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件主题',
|
||||
tip: '邮箱登录未指定邮箱账号',
|
||||
});
|
||||
}
|
||||
}
|
||||
else if ((!config.text || config.text === '' || !config.text?.includes('${code}')) &&
|
||||
(!config.html || config.html === '' || !config.html?.includes('${code}'))) {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件内容模板' });
|
||||
else if (!config.subject || config.subject === '') {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件主题' });
|
||||
}
|
||||
else {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件主题',
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件内容模板',
|
||||
});
|
||||
else if ((!config.text || config.text === '' || !config.text?.includes('${code}')) &&
|
||||
(!config.html || config.html === '' || !config.html?.includes('${code}'))) {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件内容模板' });
|
||||
}
|
||||
else {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件内容模板',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ export default function Sms(props: {
|
|||
};
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}): React.JSX.Element;
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ export default function Sms(props) {
|
|||
<Form labelCol={{ span: 4 }} wrapperCol={{ span: 20 }} style={{ maxWidth: 900, marginTop: 16 }}>
|
||||
<Form.Item label="模拟发送" tooltip="开启模拟发送短信,发短信不会调用api">
|
||||
<Switch checkedChildren="是" unCheckedChildren="否" checked={config?.mockSend} onChange={(checked) => {
|
||||
updateConfig(id, config, 'mockSend', checked);
|
||||
updateConfig(id, config, 'mockSend', checked, 'sms');
|
||||
}}/>
|
||||
</Form.Item>
|
||||
<Form.Item label="默认渠道" tooltip="发送短信渠道,如阿里云、腾讯云、天翼云">
|
||||
<>
|
||||
<Select placeholder="请选择渠道" value={config?.defaultOrigin} style={{ width: 120 }} onChange={(value) => {
|
||||
updateConfig(id, config, 'defaultOrigin', value);
|
||||
updateConfig(id, config, 'defaultOrigin', value, 'sms');
|
||||
}} options={[
|
||||
{ value: 'ali', label: '阿里云' },
|
||||
{ value: 'tencent', label: '腾讯云' },
|
||||
|
|
@ -44,7 +44,7 @@ export default function Sms(props) {
|
|||
setTemplateName(e.target.value);
|
||||
}} onBlur={() => {
|
||||
if (templateName !== config?.templateName) {
|
||||
updateConfig(id, config, 'templateName', templateName);
|
||||
updateConfig(id, config, 'templateName', templateName, 'sms');
|
||||
}
|
||||
}}/>
|
||||
</Form.Item>
|
||||
|
|
@ -59,10 +59,10 @@ export default function Sms(props) {
|
|||
}
|
||||
}} onBlur={() => {
|
||||
if (Number(smsCodeDuration) > 0) {
|
||||
updateConfig(id, config, 'codeDuration', smsCodeDuration);
|
||||
updateConfig(id, config, 'codeDuration', smsCodeDuration, 'sms');
|
||||
}
|
||||
else {
|
||||
updateConfig(id, config, 'codeDuration', undefined);
|
||||
updateConfig(id, config, 'codeDuration', undefined, 'sms');
|
||||
}
|
||||
}} suffix="分钟"/>
|
||||
</Form.Item>
|
||||
|
|
@ -77,10 +77,10 @@ export default function Sms(props) {
|
|||
}
|
||||
}} onBlur={() => {
|
||||
if (Number(smsDigit) > 0) {
|
||||
updateConfig(id, config, 'digit', smsDigit);
|
||||
updateConfig(id, config, 'digit', smsDigit, 'sms');
|
||||
}
|
||||
else {
|
||||
updateConfig(id, config, 'digit', undefined);
|
||||
updateConfig(id, config, 'digit', undefined, 'sms');
|
||||
}
|
||||
}}/>
|
||||
</Form.Item>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default function render(props: WebComponentProps<EntityDict, 'passport',
|
|||
systemId: string;
|
||||
systemName: string;
|
||||
}, {
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
checkConfrim: () => {
|
||||
id: string;
|
||||
type: EntityDict['passport']['Schema']['type'];
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ export default function wechatMpForWeb(props: {
|
|||
appIdStr: string;
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}): React.JSX.Element;
|
||||
|
|
|
|||
|
|
@ -8,5 +8,5 @@ export default function wechatPublicForWeb(props: {
|
|||
appIdStr: string;
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}): React.JSX.Element;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"Send": "发送验证码",
|
||||
"placeholder": {
|
||||
"Captcha": "输入4位验证码",
|
||||
"email": "请输入邮箱"
|
||||
"Email": "请输入邮箱"
|
||||
},
|
||||
"resendAfter": "秒后可重发"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export default function Render(props) {
|
|||
<Form.Item name="mobile">
|
||||
<Input allowClear value={account} size="large"
|
||||
// maxLength={11}
|
||||
prefix={<UserOutlined />} placeholder={allowSms ? t('placeholder.Account') + t('placeholder.Mobile') : (allowEmail ? t('placeholder.Account') + t('placeholder.Email') : t('placeholder.Account'))} onChange={(e) => {
|
||||
prefix={<UserOutlined />} placeholder={t('placeholder.Account') + (allowSms ? t('placeholder.Mobile') : '') + (allowEmail ? t('placeholder.Email') : '')} onChange={(e) => {
|
||||
inputChange('account', e.target.value);
|
||||
}} className={Style['loginbox-input']}/>
|
||||
</Form.Item>
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ const i18ns = [
|
|||
"Send": "发送验证码",
|
||||
"placeholder": {
|
||||
"Captcha": "输入4位验证码",
|
||||
"email": "请输入邮箱"
|
||||
"Email": "请输入邮箱"
|
||||
},
|
||||
"resendAfter": "秒后可重发"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export type SmsConfig = {
|
|||
digit?: number;
|
||||
};
|
||||
export type EmailConfig = {
|
||||
mockSend?: boolean;
|
||||
account: string;
|
||||
subject: string;
|
||||
text?: string;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export type SmsConfig = {
|
|||
digit?: number;
|
||||
};
|
||||
export type EmailConfig = {
|
||||
mockSend?: boolean;
|
||||
account: string;
|
||||
subject: string;
|
||||
text?: string;
|
||||
|
|
|
|||
|
|
@ -1372,7 +1372,7 @@ async function sendCaptchaByMobile({ mobile, env, type: type2, }, context) {
|
|||
}
|
||||
const now = Date.now();
|
||||
const closeRootMode = context.openRootMode();
|
||||
if (process.env.NODE_ENV !== 'development' && !mockSend) {
|
||||
if (!mockSend) {
|
||||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
|
|
@ -1423,7 +1423,7 @@ async function sendCaptchaByMobile({ mobile, env, type: type2, }, context) {
|
|||
});
|
||||
if (captcha) {
|
||||
const code = captcha.code;
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1449,7 +1449,7 @@ async function sendCaptchaByMobile({ mobile, env, type: type2, }, context) {
|
|||
}
|
||||
else {
|
||||
let code;
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
code = mobile.substring(11 - digit);
|
||||
}
|
||||
else {
|
||||
|
|
@ -1476,7 +1476,7 @@ async function sendCaptchaByMobile({ mobile, env, type: type2, }, context) {
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1532,6 +1532,7 @@ async function sendCaptchaByEmail({ email, env, type: type2, }, context) {
|
|||
(0, assert_1.assert)(emailConfig);
|
||||
const duration = config.codeDuration || 5;
|
||||
const digit = config.digit || 4;
|
||||
const mockSend = config.mockSend;
|
||||
let emailOptions = {
|
||||
host: emailConfig.host,
|
||||
port: emailConfig.port,
|
||||
|
|
@ -1545,7 +1546,7 @@ async function sendCaptchaByEmail({ email, env, type: type2, }, context) {
|
|||
};
|
||||
const now = Date.now();
|
||||
const closeRootMode = context.openRootMode();
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
if (!mockSend) {
|
||||
const [count1, count2] = await Promise.all([
|
||||
context.count('captcha', {
|
||||
filter: {
|
||||
|
|
@ -1596,7 +1597,7 @@ async function sendCaptchaByEmail({ email, env, type: type2, }, context) {
|
|||
});
|
||||
if (captcha) {
|
||||
const code = captcha.code;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1643,7 +1644,7 @@ async function sendCaptchaByEmail({ email, env, type: type2, }, context) {
|
|||
}, {
|
||||
dontCollect: true,
|
||||
});
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
}
|
||||
|
|
@ -1862,8 +1863,8 @@ async function refreshToken(params, context) {
|
|||
// 只有server模式去刷新token
|
||||
// 'development' | 'production' | 'staging'
|
||||
const intervals = {
|
||||
development: 7200 * 1000, // 2小时
|
||||
staging: 600 * 1000, // 十分钟
|
||||
development: 7200 * 1000,
|
||||
staging: 600 * 1000,
|
||||
production: 600 * 1000, // 十分钟
|
||||
};
|
||||
const application = context.getApplication();
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ const i18ns = [
|
|||
"Send": "发送验证码",
|
||||
"placeholder": {
|
||||
"Captcha": "输入4位验证码",
|
||||
"email": "请输入邮箱"
|
||||
"Email": "请输入邮箱"
|
||||
},
|
||||
"resendAfter": "秒后可重发"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export type SmsConfig = {
|
|||
digit?: number;
|
||||
};
|
||||
export type EmailConfig = {
|
||||
mockSend?: boolean;
|
||||
account: string;
|
||||
subject: string;
|
||||
text?: string;
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export type SmsConfig = {
|
|||
digit?: number;
|
||||
};
|
||||
export type EmailConfig = {
|
||||
mockSend?: boolean;
|
||||
account: string;
|
||||
subject: string;
|
||||
text?: string;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ const assert_1 = require("oak-domain/lib/utils/assert");
|
|||
const node_mailer_1 = tslib_1.__importDefault(require("./node-mailer"));
|
||||
const EmailDict = {
|
||||
nodemailer: new node_mailer_1.default(),
|
||||
|
||||
};
|
||||
/**
|
||||
* 注入一个其它发送邮件类
|
||||
|
|
|
|||
|
|
@ -1893,7 +1893,7 @@ export async function sendCaptchaByMobile<ED extends EntityDict>(
|
|||
}
|
||||
const now = Date.now();
|
||||
const closeRootMode = context.openRootMode();
|
||||
if (process.env.NODE_ENV !== 'development' && !mockSend) {
|
||||
if (!mockSend) {
|
||||
const [count1, count2] = await Promise.all([
|
||||
context.count(
|
||||
'captcha',
|
||||
|
|
@ -1956,7 +1956,7 @@ export async function sendCaptchaByMobile<ED extends EntityDict>(
|
|||
);
|
||||
if (captcha) {
|
||||
const code = captcha.code!;
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
} else if (now - (captcha.$$createAt$$! as number) < 60000) {
|
||||
|
|
@ -1982,7 +1982,7 @@ export async function sendCaptchaByMobile<ED extends EntityDict>(
|
|||
}
|
||||
} else {
|
||||
let code: string;
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
code = mobile.substring(11 - digit);
|
||||
} else {
|
||||
code = Math.floor(Math.random() * Math.pow(10, digit)).toString();
|
||||
|
|
@ -2014,7 +2014,7 @@ export async function sendCaptchaByMobile<ED extends EntityDict>(
|
|||
}
|
||||
);
|
||||
|
||||
if (process.env.NODE_ENV === 'development' || mockSend) {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
} else {
|
||||
|
|
@ -2087,6 +2087,7 @@ export async function sendCaptchaByEmail<ED extends EntityDict>(
|
|||
assert(emailConfig);
|
||||
const duration = config.codeDuration || 5;
|
||||
const digit = config.digit || 4;
|
||||
const mockSend = config.mockSend;
|
||||
|
||||
let emailOptions: EmailOptions = {
|
||||
host: emailConfig.host,
|
||||
|
|
@ -2102,7 +2103,7 @@ export async function sendCaptchaByEmail<ED extends EntityDict>(
|
|||
|
||||
const now = Date.now();
|
||||
const closeRootMode = context.openRootMode();
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
if (!mockSend) {
|
||||
const [count1, count2] = await Promise.all([
|
||||
context.count(
|
||||
'captcha',
|
||||
|
|
@ -2165,7 +2166,7 @@ export async function sendCaptchaByEmail<ED extends EntityDict>(
|
|||
);
|
||||
if (captcha) {
|
||||
const code = captcha.code!;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
} else if (now - (captcha.$$createAt$$! as number) < 60000) {
|
||||
|
|
@ -2214,7 +2215,7 @@ export async function sendCaptchaByEmail<ED extends EntityDict>(
|
|||
}
|
||||
);
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (mockSend) {
|
||||
closeRootMode();
|
||||
return `验证码[${code}]已创建`;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -249,24 +249,26 @@ export default OakComponent({
|
|||
}
|
||||
break;
|
||||
case 'email':
|
||||
if (!(pConfig as EmailConfig).account || (pConfig as EmailConfig).account === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置账号',
|
||||
if (!(pConfig as EmailConfig).mockSend) {
|
||||
if (!(pConfig as EmailConfig).account || (pConfig as EmailConfig).account === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置账号',
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(pConfig as EmailConfig).subject || (pConfig as EmailConfig).subject === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件主题',
|
||||
}
|
||||
} else if (
|
||||
(!(pConfig as EmailConfig).text || (pConfig as EmailConfig).text === '' || !(pConfig as EmailConfig).text?.includes('${code}')) &&
|
||||
(!(pConfig as EmailConfig).html || (pConfig as EmailConfig).html === '' || !(pConfig as EmailConfig).html?.includes('${code}'))
|
||||
) {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件内容模板',
|
||||
else if (!(pConfig as EmailConfig).subject || (pConfig as EmailConfig).subject === '') {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件主题',
|
||||
}
|
||||
} else if (
|
||||
(!(pConfig as EmailConfig).text || (pConfig as EmailConfig).text === '' || !(pConfig as EmailConfig).text?.includes('${code}')) &&
|
||||
(!(pConfig as EmailConfig).html || (pConfig as EmailConfig).html === '' || !(pConfig as EmailConfig).html?.includes('${code}'))
|
||||
) {
|
||||
return {
|
||||
disabled: true,
|
||||
disabledTip: '邮箱登录未配置邮件内容模板',
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export default function Email(props: {
|
|||
passport: EntityDict['passport']['OpSchema'] & { stateColor: string };
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}) {
|
||||
const { passport, t, changeEnabled, updateConfig } = props;
|
||||
const { id, type, enabled, stateColor } = passport;
|
||||
|
|
@ -96,6 +96,19 @@ export default function Email(props: {
|
|||
wrapperCol={{ span: 20 }}
|
||||
style={{ maxWidth: 900, marginTop: 16 }}
|
||||
>
|
||||
<Form.Item
|
||||
label="模拟发送"
|
||||
tooltip="开启模拟发送验证码,发邮件不会调用api"
|
||||
>
|
||||
<Switch
|
||||
checkedChildren="是"
|
||||
unCheckedChildren="否"
|
||||
checked={(config as EmailConfig)?.mockSend}
|
||||
onChange={(checked) => {
|
||||
updateConfig(id, config!, 'mockSend', checked, 'email');
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="邮件主题"
|
||||
// tooltip=""
|
||||
|
|
@ -109,7 +122,7 @@ export default function Email(props: {
|
|||
}}
|
||||
onBlur={() => {
|
||||
if (subject !== (config as EmailConfig)?.subject) {
|
||||
updateConfig(id, config!, 'subject', subject);
|
||||
updateConfig(id, config!, 'subject', subject, 'email');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
@ -141,7 +154,7 @@ export default function Email(props: {
|
|||
}}
|
||||
onBlur={() => {
|
||||
if (text !== (config as EmailConfig)?.text) {
|
||||
updateConfig(id, config!, 'text', text);
|
||||
updateConfig(id, config!, 'text', text, 'email');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
@ -159,7 +172,7 @@ export default function Email(props: {
|
|||
onCreated={setEditor}
|
||||
onChange={editor => {
|
||||
setHtml(editor.getHtml());
|
||||
updateConfig(id, config!, 'html', editor.getHtml());
|
||||
updateConfig(id, config!, 'html', editor.getHtml(), 'email');
|
||||
}}
|
||||
mode="default"
|
||||
style={{ height: '260px', overflowY: 'hidden' }}
|
||||
|
|
@ -187,9 +200,9 @@ export default function Email(props: {
|
|||
}}
|
||||
onBlur={() => {
|
||||
if (Number(emailCodeDuration) > 0) {
|
||||
updateConfig(id, config!, 'codeDuration', emailCodeDuration);
|
||||
updateConfig(id, config!, 'codeDuration', emailCodeDuration, 'email');
|
||||
} else {
|
||||
updateConfig(id, config!, 'codeDuration', undefined);
|
||||
updateConfig(id, config!, 'codeDuration', undefined, 'email');
|
||||
}
|
||||
}}
|
||||
suffix="分钟"
|
||||
|
|
@ -215,9 +228,9 @@ export default function Email(props: {
|
|||
}}
|
||||
onBlur={() => {
|
||||
if (Number(emailDigit) > 0) {
|
||||
updateConfig(id, config!, 'digit', emailDigit);
|
||||
updateConfig(id, config!, 'digit', emailDigit, 'email');
|
||||
} else {
|
||||
updateConfig(id, config!, 'digit', undefined);
|
||||
updateConfig(id, config!, 'digit', undefined, 'email');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -61,20 +61,42 @@ export default OakComponent({
|
|||
lifetimes: {
|
||||
},
|
||||
methods: {
|
||||
updateConfig(id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) {
|
||||
updateConfig(id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) {
|
||||
const newConfig = cloneDeep(config);
|
||||
set(newConfig, path, value);
|
||||
if (path === 'mockSend' && !value) {
|
||||
if (!(newConfig as SmsConfig).templateName || (newConfig as SmsConfig).templateName === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未配置模板名称,将无法正常使用短信登录'
|
||||
})
|
||||
} else if (!(newConfig as SmsConfig).defaultOrigin) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未选择默认渠道,将无法正常使用短信登录'
|
||||
})
|
||||
if (type === 'sms') {
|
||||
if (!(newConfig as SmsConfig).templateName || (newConfig as SmsConfig).templateName === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未配置模板名称,将无法正常使用短信登录'
|
||||
})
|
||||
} else if (!(newConfig as SmsConfig).defaultOrigin) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '短信登录未选择默认渠道,将无法正常使用短信登录'
|
||||
})
|
||||
}
|
||||
} else if (type === 'email') {
|
||||
if (!(newConfig as EmailConfig).account || (newConfig as EmailConfig).account === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '邮箱登录未指定邮箱账号,将无法正常使用短信登录'
|
||||
})
|
||||
} else if (!(newConfig as EmailConfig).subject || (newConfig as EmailConfig).subject === '') {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '邮箱登录未配置邮件主题,将无法正常使用短信登录'
|
||||
})
|
||||
} else if (
|
||||
(!(newConfig as EmailConfig).text || (newConfig as EmailConfig).text === '' || !(newConfig as EmailConfig).text?.includes('${code}')) &&
|
||||
(!(newConfig as EmailConfig).html || (newConfig as EmailConfig).html === '' || !(newConfig as EmailConfig).html?.includes('${code}'))
|
||||
) {
|
||||
this.setMessage({
|
||||
type: 'warning',
|
||||
content: '邮箱登录未配置邮件内容模板,将无法正常使用短信登录'
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if (path === 'appId' && (!value || value === '')) {
|
||||
this.setMessage({
|
||||
|
|
@ -123,36 +145,38 @@ export default OakComponent({
|
|||
}
|
||||
break;
|
||||
case 'email':
|
||||
if (!(config as EmailConfig).account || (config as EmailConfig).account === '') {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未指定邮箱账号',
|
||||
});
|
||||
} else if (!(config as EmailConfig).subject || (config as EmailConfig).subject === '') {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件主题' });
|
||||
} else {
|
||||
if (!(config as EmailConfig).mockSend) {
|
||||
if (!(config as EmailConfig).account || (config as EmailConfig).account === '') {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件主题',
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
(!(config as EmailConfig).text || (config as EmailConfig).text === '' || !(config as EmailConfig).text?.includes('${code}')) &&
|
||||
(!(config as EmailConfig).html || (config as EmailConfig).html === '' || !(config as EmailConfig).html?.includes('${code}'))
|
||||
) {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件内容模板' });
|
||||
} else {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件内容模板',
|
||||
tip: '邮箱登录未指定邮箱账号',
|
||||
});
|
||||
} else if (!(config as EmailConfig).subject || (config as EmailConfig).subject === '') {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件主题' });
|
||||
} else {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件主题',
|
||||
});
|
||||
}
|
||||
} else if (
|
||||
(!(config as EmailConfig).text || (config as EmailConfig).text === '' || !(config as EmailConfig).text?.includes('${code}')) &&
|
||||
(!(config as EmailConfig).html || (config as EmailConfig).html === '' || !(config as EmailConfig).html?.includes('${code}'))
|
||||
) {
|
||||
const emailWarning = warnings.find((ele) => ele.id === id);
|
||||
if (emailWarning) {
|
||||
Object.assign(emailWarning, { tip: emailWarning.tip + '、邮件内容模板' });
|
||||
} else {
|
||||
warnings.push({
|
||||
id,
|
||||
type,
|
||||
tip: '邮箱登录未配置邮件内容模板',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export default function Sms(props: {
|
|||
passport: EntityDict['passport']['OpSchema'] & { stateColor: string };
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}) {
|
||||
const { passport, t, changeEnabled, updateConfig } = props;
|
||||
const { id, type, enabled, stateColor } = passport;
|
||||
|
|
@ -52,7 +52,7 @@ export default function Sms(props: {
|
|||
unCheckedChildren="否"
|
||||
checked={(config as SmsConfig)?.mockSend}
|
||||
onChange={(checked) => {
|
||||
updateConfig(id, config!, 'mockSend', checked);
|
||||
updateConfig(id, config!, 'mockSend', checked, 'sms');
|
||||
}}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
|
@ -66,7 +66,7 @@ export default function Sms(props: {
|
|||
value={(config as SmsConfig)?.defaultOrigin}
|
||||
style={{ width: 120 }}
|
||||
onChange={(value) => {
|
||||
updateConfig(id, config!, 'defaultOrigin', value);
|
||||
updateConfig(id, config!, 'defaultOrigin', value, 'sms');
|
||||
}}
|
||||
options={[
|
||||
{ value: 'ali', label: '阿里云' },
|
||||
|
|
@ -86,7 +86,7 @@ export default function Sms(props: {
|
|||
}}
|
||||
onBlur={() => {
|
||||
if (templateName !== (config as SmsConfig)?.templateName) {
|
||||
updateConfig(id, config!, 'templateName', templateName);
|
||||
updateConfig(id, config!, 'templateName', templateName, 'sms');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
@ -110,9 +110,9 @@ export default function Sms(props: {
|
|||
}}
|
||||
onBlur={() => {
|
||||
if (Number(smsCodeDuration) > 0) {
|
||||
updateConfig(id, config!, 'codeDuration', smsCodeDuration);
|
||||
updateConfig(id, config!, 'codeDuration', smsCodeDuration, 'sms');
|
||||
} else {
|
||||
updateConfig(id, config!, 'codeDuration', undefined);
|
||||
updateConfig(id, config!, 'codeDuration', undefined, 'sms');
|
||||
}
|
||||
}}
|
||||
suffix="分钟"
|
||||
|
|
@ -138,9 +138,9 @@ export default function Sms(props: {
|
|||
}}
|
||||
onBlur={() => {
|
||||
if (Number(smsDigit) > 0) {
|
||||
updateConfig(id, config!, 'digit', smsDigit);
|
||||
updateConfig(id, config!, 'digit', smsDigit, 'sms');
|
||||
} else {
|
||||
updateConfig(id, config!, 'digit', undefined);
|
||||
updateConfig(id, config!, 'digit', undefined, 'sms');
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function AppView(props: {
|
|||
passport: EntityDict['passport']['OpSchema'] & { appIdStr: string; stateColor: string };
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}) {
|
||||
const { passport, t, changeEnabled, updateConfig } = props;
|
||||
const { id, type, config, enabled, stateColor } = passport;
|
||||
|
|
@ -49,7 +49,7 @@ export default function render(props: WebComponentProps<
|
|||
systemName: string;
|
||||
},
|
||||
{
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
checkConfrim: () => {
|
||||
id: string;
|
||||
type: EntityDict['passport']['Schema']['type'];
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default function wechatMpForWeb(props: {
|
|||
appIdStr: string;
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}) {
|
||||
const { passport, appIdStr, t, changeEnabled, updateConfig } = props;
|
||||
const { id, type, enabled, stateColor } = passport;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default function wechatPublicForWeb(props: {
|
|||
appIdStr: string;
|
||||
t: (k: string, params?: any) => string;
|
||||
changeEnabled: (enabled: boolean) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any) => void;
|
||||
updateConfig: (id: string, config: SmsConfig | EmailConfig | PfwConfig | MfwConfig, path: string, value: any, type?: string) => void;
|
||||
}) {
|
||||
const { passport, appIdStr, t, changeEnabled, updateConfig } = props;
|
||||
const { id, type, enabled, stateColor } = passport;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"Send": "发送验证码",
|
||||
"placeholder": {
|
||||
"Captcha": "输入4位验证码",
|
||||
"email": "请输入邮箱"
|
||||
"Email": "请输入邮箱"
|
||||
},
|
||||
"resendAfter": "秒后可重发"
|
||||
}
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ export default function Render(
|
|||
size="large"
|
||||
// maxLength={11}
|
||||
prefix={<UserOutlined />}
|
||||
placeholder={allowSms ? t('placeholder.Account') + t('placeholder.Mobile') : (allowEmail ? t('placeholder.Account') + t('placeholder.Email') : t('placeholder.Account'))}
|
||||
placeholder={t('placeholder.Account') + (allowSms ? t('placeholder.Mobile') : '') + (allowEmail ? t('placeholder.Email') : '')}
|
||||
onChange={(e) => {
|
||||
inputChange('account', e.target.value);
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ const i18ns: I18n[] = [
|
|||
"Send": "发送验证码",
|
||||
"placeholder": {
|
||||
"Captcha": "输入4位验证码",
|
||||
"email": "请输入邮箱"
|
||||
"Email": "请输入邮箱"
|
||||
},
|
||||
"resendAfter": "秒后可重发"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export type SmsConfig = {
|
|||
};
|
||||
|
||||
export type EmailConfig = {
|
||||
mockSend?: boolean;
|
||||
account: string;
|
||||
subject: string;
|
||||
text?: string;
|
||||
|
|
|
|||
Loading…
Reference in New Issue