提交 5eb06f8e 编写于 作者: zhangpingchuan's avatar zhangpingchuan

feat: 增加验证码、密码加密功能

上级 a21336b7
...@@ -99,7 +99,7 @@ export const ChangePassword = defineComponent({ ...@@ -99,7 +99,7 @@ export const ChangePassword = defineComponent({
try { try {
loading.value = true; loading.value = true;
let { oldPwd, newPwd } = userData; let { oldPwd, newPwd } = userData;
if (ibiz.env.publicKey) { if (ibiz.env.enableRSA) {
oldPwd = ibiz.util.text.rsa(oldPwd); oldPwd = ibiz.util.text.rsa(oldPwd);
newPwd = ibiz.util.text.rsa(newPwd); newPwd = ibiz.util.text.rsa(newPwd);
} }
...@@ -116,7 +116,6 @@ export const ChangePassword = defineComponent({ ...@@ -116,7 +116,6 @@ export const ChangePassword = defineComponent({
title: res.data?.message || '修改密码失败', title: res.data?.message || '修改密码失败',
}); });
} }
console.log(props);
props.dismiss?.({ ok: true, data: {} }); props.dismiss?.({ ok: true, data: {} });
loading.value = false; loading.value = false;
} catch (error) { } catch (error) {
......
...@@ -157,7 +157,7 @@ export const ForgetPassword = defineComponent({ ...@@ -157,7 +157,7 @@ export const ForgetPassword = defineComponent({
loading.value = true; loading.value = true;
const { loginName, verificationCode } = userData; const { loginName, verificationCode } = userData;
let { newPwd, comfirmPwd } = userData; let { newPwd, comfirmPwd } = userData;
if (ibiz.env.publicKey) { if (ibiz.env.enableRSA) {
newPwd = ibiz.util.text.rsa(newPwd); newPwd = ibiz.util.text.rsa(newPwd);
comfirmPwd = ibiz.util.text.rsa(comfirmPwd); comfirmPwd = ibiz.util.text.rsa(comfirmPwd);
} }
......
...@@ -92,13 +92,15 @@ export default defineComponent({ ...@@ -92,13 +92,15 @@ export default defineComponent({
loading.value = true; loading.value = true;
clearCookie(CoreConst.TOKEN, true); clearCookie(CoreConst.TOKEN, true);
let password = loginData.password; let password = loginData.password;
if ((ibiz.env as IData).enableSM3) { let verificationcode = loginData.verificationCode;
password = ibiz.util.text.sm3(password).toUpperCase(); if ((ibiz.env as IData).enableRSA) {
password = ibiz.util.text.rsa(password);
verificationcode = ibiz.util.text.rsa(verificationcode);
} }
const res = await ibiz.net.post('/v7/loginPwd', { const res = await ibiz.net.post('/v7/loginPwd', {
loginname: loginData.username, loginname: loginData.username,
password, password,
verificationcode: loginData.verificationCode, verificationcode,
}); });
if (res.ok) { if (res.ok) {
const { data } = res; const { data } = res;
......
...@@ -76,8 +76,8 @@ export default defineComponent({ ...@@ -76,8 +76,8 @@ export default defineComponent({
loading.value = true; loading.value = true;
clearCookie(CoreConst.TOKEN, true); clearCookie(CoreConst.TOKEN, true);
let password = loginData.password; let password = loginData.password;
if ((ibiz.env as IData).enableSM3) { if ((ibiz.env as IData).enableRSA) {
password = ibiz.util.text.sm3(password).toUpperCase(); password = ibiz.util.text.sm3(password);
} }
const res = await ibiz.auth.v7login(loginData.username, password); const res = await ibiz.auth.v7login(loginData.username, password);
if (res.ok) { if (res.ok) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册