密码混淆
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
"bignumber.js": "^9.0.0",
|
||||
"dva": "^2.6.0-beta.12",
|
||||
"lodash": "^4.17.15",
|
||||
"md5": "^2.2.1",
|
||||
"qrcanvas-react": "^2.0.1",
|
||||
"react": "^16.9.0",
|
||||
"react-clipboard.js": "^2.0.13",
|
||||
@@ -31,6 +32,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.0.18",
|
||||
"@types/md5": "^2.1.33",
|
||||
"@types/react": "^16.9.2",
|
||||
"@types/react-dom": "^16.9.0",
|
||||
"@types/react-test-renderer": "^16.0.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import http from '@/utils/http';
|
||||
import { AreaCode, SendCodeType } from '@/types/common';
|
||||
import { encodePhone } from '@/utils/transform';
|
||||
import { encodePhone, encryptPwd } from '@/utils/transform';
|
||||
|
||||
export enum CheckResult {
|
||||
Login = 0,
|
||||
@@ -20,7 +20,7 @@ export async function signIn(areacode: AreaCode, phone: string, password: string
|
||||
'/sign/in',
|
||||
{
|
||||
phone: encodePhone(areacode, phone),
|
||||
password,
|
||||
password: encryptPwd(password),
|
||||
},
|
||||
);
|
||||
if (!ok || !data || !data.token) {
|
||||
@@ -34,7 +34,7 @@ export async function signUp(areacode: AreaCode, phone: string, password: string
|
||||
'/sign/upwi',
|
||||
{
|
||||
phone: encodePhone(areacode, phone),
|
||||
password,
|
||||
password: encryptPwd(password),
|
||||
inviter,
|
||||
code,
|
||||
},
|
||||
@@ -50,7 +50,7 @@ export async function reset(areacode: AreaCode, phone: string, password: string,
|
||||
'/sign/forget',
|
||||
{
|
||||
phone: encodePhone(areacode, phone),
|
||||
password,
|
||||
password: encryptPwd(password),
|
||||
code,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import http from '@/utils/http';
|
||||
import { encryptPwd } from '@/utils/transform';
|
||||
|
||||
export async function changeFundPwd(newPassword: string, password?: string) {
|
||||
const { ok, msg } = await http.post('/user/chFundPwd', {
|
||||
password,
|
||||
newPassword,
|
||||
password: password && encryptPwd(password),
|
||||
newPassword: encryptPwd(newPassword),
|
||||
});
|
||||
if (ok) return;
|
||||
throw Error(msg);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import http from '@/utils/http';
|
||||
import { encryptPwd } from '@/utils/transform';
|
||||
|
||||
export async function changeLgpwd(newPassword: string, password?: string) {
|
||||
export async function changeLgpwd(newPassword: string, password: string) {
|
||||
const { ok, msg } = await http.post('/user/chpasswd', {
|
||||
password,
|
||||
newPassword,
|
||||
password: encryptPwd(password),
|
||||
newPassword: encryptPwd(newPassword),
|
||||
});
|
||||
if (ok) return;
|
||||
throw Error(msg);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import BigNumber from 'bignumber.js';
|
||||
import _ from 'lodash';
|
||||
import md5 from 'md5';
|
||||
import { AreaCode, Estate } from '@/types/common';
|
||||
|
||||
export function encodePhone(code: AreaCode, phone: string): string {
|
||||
@@ -41,3 +42,7 @@ export function fromLangToText(lang: string) {
|
||||
const target = _.find(supportedLangs, { lang });
|
||||
return target && target.text;
|
||||
}
|
||||
|
||||
export function encryptPwd(pwd: string): string {
|
||||
return md5(pwd);
|
||||
}
|
||||
|
||||
28
yarn.lock
28
yarn.lock
@@ -1505,6 +1505,13 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.137.tgz#8a4804937dc6462274ffcc088df8f14fc1b368e2"
|
||||
integrity sha512-g4rNK5SRKloO+sUGbuO7aPtwbwzMgjK+bm9BBhLD7jGUiGR7zhwYEhSln/ihgYQBeIJ5j7xjyaYzrWTcu3UotQ==
|
||||
|
||||
"@types/md5@^2.1.33":
|
||||
version "2.1.33"
|
||||
resolved "https://registry.yarnpkg.com/@types/md5/-/md5-2.1.33.tgz#8c8dba30df4ad0e92296424f08c4898dd808e8df"
|
||||
integrity sha512-8+X960EtKLoSblhauxLKy3zzotagjoj3Jt1Tx9oaxUdZEPIBl+mkrUz6PNKpzJgkrKSN9YgkWTA29c0KnLshmA==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/minimatch@*", "@types/minimatch@^3.0.3":
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
|
||||
@@ -3482,6 +3489,11 @@ chardet@^0.7.0:
|
||||
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
|
||||
integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==
|
||||
|
||||
charenc@~0.0.1:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
|
||||
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=
|
||||
|
||||
check-types@^8.0.3:
|
||||
version "8.0.3"
|
||||
resolved "https://registry.yarnpkg.com/check-types/-/check-types-8.0.3.tgz#3356cca19c889544f2d7a95ed49ce508a0ecf552"
|
||||
@@ -4171,6 +4183,11 @@ cross-spawn@^5.0.1:
|
||||
shebang-command "^1.2.0"
|
||||
which "^1.2.9"
|
||||
|
||||
crypt@~0.0.1:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
|
||||
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
|
||||
|
||||
crypto-browserify@^3.11.0:
|
||||
version "3.12.0"
|
||||
resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec"
|
||||
@@ -7740,7 +7757,7 @@ is-boolean-object@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.0.tgz#98f8b28030684219a95f375cfbd88ce3405dff93"
|
||||
integrity sha1-mPiygDBoQhmpXzdc+9iM40Bd/5M=
|
||||
|
||||
is-buffer@^1.0.2, is-buffer@^1.1.4, is-buffer@^1.1.5:
|
||||
is-buffer@^1.0.2, is-buffer@^1.1.4, is-buffer@^1.1.5, is-buffer@~1.1.1:
|
||||
version "1.1.6"
|
||||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
|
||||
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
|
||||
@@ -9443,6 +9460,15 @@ md5.js@^1.3.4:
|
||||
inherits "^2.0.1"
|
||||
safe-buffer "^5.1.2"
|
||||
|
||||
md5@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9"
|
||||
integrity sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=
|
||||
dependencies:
|
||||
charenc "~0.0.1"
|
||||
crypt "~0.0.1"
|
||||
is-buffer "~1.1.1"
|
||||
|
||||
mdast-util-compact@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/mdast-util-compact/-/mdast-util-compact-1.0.3.tgz#98a25cc8a7865761a41477b3a87d1dcef0b1e79d"
|
||||
|
||||
Reference in New Issue
Block a user