🎉 增加验证码配置开关

This commit is contained in:
smallchill 2020-03-24 14:30:34 +08:00
parent 4a58def4fb
commit 3f007b94d2
3 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,7 @@ module.exports = {
clientId: 'sword', // 客户端id
clientSecret: 'sword_secret', // 客户端密钥
tenantMode: true, // 开启租户模式
captchaMode: true, // 开启验证码模式
navTheme: 'dark', // theme for nav menu
primaryColor: '#1890FF', // primary color of ant design
layout: 'sidemenu', // nav menu position: sidemenu or topmenu

View File

@ -4,7 +4,7 @@ import { formatMessage, FormattedMessage } from 'umi/locale';
import { Checkbox, Alert } from 'antd';
import Login from '../../components/Login';
import styles from './Login.less';
import { tenantMode } from '../../defaultSettings';
import { tenantMode, captchaMode } from '../../defaultSettings';
const { Tab, TenantId, UserName, Password, Captcha, Submit } = Login;
@ -117,7 +117,7 @@ class LoginPage extends Component {
]}
onPressEnter={() => this.loginForm.validateFields(this.handleSubmit)}
/>
<Captcha name="code" mode="image" />
{captchaMode ? <Captcha name="code" mode="image" /> : null}
</Tab>
<div>
<Checkbox checked={autoLogin} onChange={this.changeAutoLogin}>

View File

@ -2,12 +2,13 @@ import { stringify } from 'qs';
import request from '../utils/request';
import func from '../utils/Func';
import { getCaptchaKey } from '../utils/authority';
import { captchaMode } from '../defaultSettings';
// =====================用户===========================
export async function accountLogin(params) {
const values = params;
values.grantType = 'captcha';
values.grantType = captchaMode ? 'captcha' : 'password';
values.scope = 'all';
return request('/api/blade-auth/token', {
headers: {