Commit eeec60b6 authored by chenqikuai's avatar chenqikuai

fix: 修复密码自动填充的问题

parent 4b41edb8
tar -czf sy2.tar sy2
scp sy2.tar root@121.37.141.165:/var/www/html/personal/sy2.tar
rm -rf sy2.tar
rm -rf sy2
ssh root@121.37.141.165 'cd /var/www/html/personal/ && rm -rf sy2 && tar -xzf sy2.tar && rm -rf sy2.tar'
echo 'done. 👉 http://121.37.141.165:8903'
......@@ -822,9 +822,9 @@
}
},
"cqk-sy-ui": {
"version": "1.1.48",
"resolved": "https://registry.npmjs.org/cqk-sy-ui/-/cqk-sy-ui-1.1.48.tgz",
"integrity": "sha512-1x/KceNV+t1hppxBTX663FXtDHUb3M7k8QdDm8QpkZVpu90jRO8Iok0juXxgW87U/xly7rcDgKEJ3lbVdwM+ig==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/cqk-sy-ui/-/cqk-sy-ui-1.2.0.tgz",
"integrity": "sha512-0FV2qSan6EDELqmbebWVGkbKU6V2ybTVjN0C0zkf+Weaet+7q1Y6ZTFthn0Ca9yE9lc0IbNedzQeQGNbQYft6g==",
"requires": {
"axios": "^0.26.1",
"crypto-js": "^4.1.1",
......
......@@ -9,7 +9,7 @@
},
"dependencies": {
"axios": "^0.26.1",
"cqk-sy-ui": "^1.1.48",
"cqk-sy-ui": "^1.2.0",
"crypto-js": "^4.1.1",
"element-plus": "^2.1.9",
"js-md5": "^0.7.3",
......
<template>
<!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
<input style="display: none" type="text" name="fakeusernameremembered" />
<input style="display: none" type="password" name="fakepasswordremembered" />
<syTraceLoginPage
:set-pwd="setPwd"
:handle-login="handleLogin"
......@@ -6,32 +9,31 @@
></syTraceLoginPage>
</template>
<script lang="ts" setup>
import { syTraceLoginPage, GO_URLS } from "cqk-sy-ui"
import { ElMessage } from "element-plus"
import { $ajax } from "@/service/index"
import * as storage from "@/service/storage"
import md5 from 'js-md5'
import { router } from "@/router"
const setPwd: any = async (setPwdType: string, accountType: string, account: any, code: any, pwd: string | any[]) => {
import { syTraceLoginPage, GO_URLS } from "cqk-sy-ui";
import { ElMessage } from "element-plus";
import { $ajax } from "@/service/index";
import * as storage from "@/service/storage";
import md5 from "js-md5";
import { router } from "@/router";
const setPwd: any = async (
setPwdType: string,
accountType: string,
account: any,
code: any,
pwd: string | any[]
) => {
let data = {};
if (accountType === 'email') {
if (accountType === "email") {
data = {
email: account,
pwd: md5(
String(pwd) +
md5(String(pwd.length))
),
pwd: md5(String(pwd) + md5(String(pwd.length))),
code: code,
code_type: 1,
};
} else {
data = {
phone: account,
pwd: md5(
String(pwd) +
md5(String(pwd.length))
),
pwd: md5(String(pwd) + md5(String(pwd.length))),
code: code,
code_type: 0,
};
......@@ -44,9 +46,9 @@ const setPwd: any = async (setPwdType: string, accountType: string, account: any
if (res?.data) {
var message = "";
if (setPwdType === 'setPwd') {
if (setPwdType === "setPwd") {
message = "密码设置成功";
} else if (setPwdType === 'resetPwd') {
} else if (setPwdType === "resetPwd") {
message = "密码重置成功";
}
ElMessage({
......@@ -54,14 +56,21 @@ const setPwd: any = async (setPwdType: string, accountType: string, account: any
type: "success",
});
return true;
}else{
} else {
return res?.msg;
}
}
const handleLogin: any = async (accountType: string, account: any, verificationMethod: string, verificationStr: any, remember: any, setError: any) => {
if (accountType === 'email') {
};
const handleLogin: any = async (
accountType: string,
account: any,
verificationMethod: string,
verificationStr: any,
remember: any,
setError: any
) => {
if (accountType === "email") {
let params = {};
if (verificationMethod === 'code') {
if (verificationMethod === "code") {
params = {
login_type: 3,
email: account,
......@@ -71,9 +80,7 @@ const handleLogin: any = async (accountType: string, account: any, verificationM
params = {
login_type: 2,
email: account,
pwd: md5(
String(verificationStr) + md5(String(verificationStr.length))
)
pwd: md5(String(verificationStr) + md5(String(verificationStr.length))),
};
}
const res = await $ajax({
......@@ -83,8 +90,8 @@ const handleLogin: any = async (accountType: string, account: any, verificationM
});
if (res && res.data) {
sessionStorage.setItem("login_type", '2');
if (accountType === 'email') {
sessionStorage.setItem("login_type", "2");
if (accountType === "email") {
storage.setLogin(
res.data,
{
......@@ -100,9 +107,9 @@ const handleLogin: any = async (accountType: string, account: any, verificationM
} else {
return res?.msg;
}
} else if (accountType === 'phone') {
} else if (accountType === "phone") {
let params = {};
if (verificationMethod === 'code') {
if (verificationMethod === "code") {
params = {
login_type: 1,
phone: account,
......@@ -112,9 +119,7 @@ const handleLogin: any = async (accountType: string, account: any, verificationM
params = {
login_type: 0,
phone: account,
pwd: md5(
String(verificationStr) + md5(String(verificationStr.length))
),
pwd: md5(String(verificationStr) + md5(String(verificationStr.length))),
};
}
const res = await $ajax({
......@@ -124,7 +129,7 @@ const handleLogin: any = async (accountType: string, account: any, verificationM
});
if (res && res.data) {
sessionStorage.setItem("login_type", '1');
sessionStorage.setItem("login_type", "1");
storage.setLogin(
res.data,
{
......@@ -142,12 +147,16 @@ const handleLogin: any = async (accountType: string, account: any, verificationM
} else {
return false;
}
}
};
const sendVerificationCode = async (accountType: string, account: any, usedFor: string) => {
const sendVerificationCode = async (
accountType: string,
account: any,
usedFor: string
) => {
let res = null as any;
if (usedFor === 'login') {
if (accountType === 'phone') {
if (usedFor === "login") {
if (accountType === "phone") {
res = await $ajax({
type: "post",
url: GO_URLS.sendSms,
......@@ -156,7 +165,7 @@ const sendVerificationCode = async (accountType: string, account: any, usedFor:
template_id: 0,
},
});
} else if (accountType === 'email') {
} else if (accountType === "email") {
res = await $ajax({
url: GO_URLS.sendEmail,
type: "post",
......@@ -166,8 +175,8 @@ const sendVerificationCode = async (accountType: string, account: any, usedFor:
},
});
}
} else if (usedFor === 'setpwd') {
if (accountType === 'phone') {
} else if (usedFor === "setpwd") {
if (accountType === "phone") {
res = await $ajax({
type: "post",
url: GO_URLS.sendSms,
......@@ -176,7 +185,7 @@ const sendVerificationCode = async (accountType: string, account: any, usedFor:
template_id: 1,
},
});
} else if (accountType === 'email') {
} else if (accountType === "email") {
res = await $ajax({
url: GO_URLS.sendEmail,
type: "post",
......@@ -194,5 +203,5 @@ const sendVerificationCode = async (accountType: string, account: any, usedFor:
});
return true;
} else return false;
}
};
</script>
......@@ -20,8 +20,8 @@ export default defineConfig({
server: {
proxy: {
"^/api": {
// target: "http://121.37.141.165:46790/",
target: "https://sy.8n.cn/api",
target: "http://121.37.141.165:46790/",
// target: "https://sy.8n.cn/api",
changeOrigin: true,
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment