From 55b18fac12e2fba01b9ed29f270dcdd923307d81 Mon Sep 17 00:00:00 2001 From: zhaofengchao <13723060510@163.com> Date: Fri, 12 Jan 2024 14:53:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E3=80=81=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/404.js | 20 ------ client/src/pages/404.jsx | 17 ++++++ client/src/pages/login/index.tsx | 18 ++---- client/src/pages/login/model.ts | 54 +++++++--------- client/src/pages/setting/CPwModal.tsx | 88 +++++++++++++++++++++++++++ client/src/pages/setting/List.tsx | 72 ++++++++++++++++++++++ client/src/pages/setting/TntModal.tsx | 48 +++++++++++++++ client/src/pages/setting/index.less | 8 +++ client/src/pages/setting/index.tsx | 65 +++++++++++++++++--- client/src/pages/setting/model.ts | 75 +++++++++++++++++++++++ client/src/services/userService.ts | 19 +++++- client/src/utils/api.ts | 3 + client/src/utils/index.ts | 11 +++- client/src/utils/request.ts | 22 ++++--- 14 files changed, 432 insertions(+), 88 deletions(-) delete mode 100644 client/src/pages/404.js create mode 100644 client/src/pages/404.jsx create mode 100644 client/src/pages/setting/CPwModal.tsx create mode 100644 client/src/pages/setting/List.tsx create mode 100644 client/src/pages/setting/TntModal.tsx create mode 100644 client/src/pages/setting/index.less create mode 100644 client/src/pages/setting/model.ts diff --git a/client/src/pages/404.js b/client/src/pages/404.js deleted file mode 100644 index 5bed6b36b..000000000 --- a/client/src/pages/404.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Button, Result } from 'antd'; -import React from 'react'; -import { history } from 'umi'; - -const NoFoundPage = () => { - return ( - history.push('/')}> - 返回主页 - < /Button> - } -/> - ); -}; - -export default NoFoundPage; diff --git a/client/src/pages/404.jsx b/client/src/pages/404.jsx new file mode 100644 index 000000000..ab8e9f168 --- /dev/null +++ b/client/src/pages/404.jsx @@ -0,0 +1,17 @@ +import { Button, Result } from 'antd'; +import React from 'react'; +import { history } from 'umi'; + +const NoFoundPage = () => { + return ( history.push('/')}> + 返回主页 + } + /> + ) +}; + +export default NoFoundPage; diff --git a/client/src/pages/login/index.tsx b/client/src/pages/login/index.tsx index 32dc4632b..aeecc410c 100644 --- a/client/src/pages/login/index.tsx +++ b/client/src/pages/login/index.tsx @@ -1,19 +1,14 @@ import { connect } from 'umi'; import { Input, Form, Button, Checkbox } from 'antd'; -// import md5 from 'md5'; import styles from './index.less'; -import JSEncrypt from 'jsencrypt'; -import { Base64 } from 'js-base64'; -import Title from 'antd/es/skeleton/Title'; +import { rsaPsw } from '@/utils' import { useState, useEffect } from 'react'; -// import Base64 from 'crypto-js/enc-base64'; + const View = ({ - loginModel, dispatch, - location, }) => { const [title, setTitle] = useState('login') - const pub = "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArq9XTUSeYr2+N1h3Afl/z8Dse/2yD0ZGrKwx+EEEcdsBLca9Ynmx3nIB5obmLlSfmskLpBo0UACBmB5rEjBp2Q2f3AG3Hjd4B+gNCG6BDaawuDlgANIhGnaTLrIqWrrcm4EMzJOnAOI1fgzJRsOOUEfaS318Eq9OVO3apEyCCt0lOQK6PuksduOjVxtltDav+guVAA068NrPYmRNabVKRNLJpL8w4D44sfth5RvZ3q9t+6RTArpEtc5sh5ChzvqPOzKGMXW83C95TxmXqpbK6olN4RevSfVjEAgCydH6HN6OhtOQEcnrU97r9H0iZOWwbw3pVrZiUkuRD1R56Wzs2wIDAQAB-----END PUBLIC KEY-----" + const changeTitle = () => { setTitle((title) => title === 'login' ? 'register' : 'login') } @@ -27,10 +22,8 @@ const View = ({ const onCheck = async () => { try { const params = await form.validateFields(); - console.log('Success:', params); - const encryptor = new JSEncrypt() - encryptor.setPublicKey(pub) - var rsaPassWord = encryptor.encrypt(Base64.encode(params.password)) + + var rsaPassWord = rsaPsw(params.password) if (title === 'login') { dispatch({ type: 'loginModel/login', @@ -103,6 +96,7 @@ const View = ({ 已有账号?登录 ) } +
第三方登录