登录密码加密

busUser
wj 2 years ago
parent 28237ca550
commit e7cd1b68ff

@ -17,6 +17,7 @@
"element-ui": "^2.15.13", "element-ui": "^2.15.13",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"js-cookie": "^2.2.0", "js-cookie": "^2.2.0",
"js-md5": "^0.7.3",
"mockjs": "^1.0.1-beta3", "mockjs": "^1.0.1-beta3",
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",

@ -12,7 +12,6 @@ export function userInfo(id, token) {
} }
export function loginName(username, password) { export function loginName(username, password) {
console.log(username + " " + password);
return axios({ return axios({
url: "/login", url: "/login",
method: "post", method: "post",

@ -23,6 +23,8 @@ import {getUUID} from "@/utils/strUtil";
import axios from "axios"; import axios from "axios";
import "../public/config.json"; import "../public/config.json";
import myReq from "./utils/axios" import myReq from "./utils/axios"
import md5 from 'js-md5';
Vue.prototype.$md5 = md5;
// 注册全局组件register global // 注册全局组件register global
Vue.component("icon-svg", IconSvg); Vue.component("icon-svg", IconSvg);
axios.defaults.withCredentials = true axios.defaults.withCredentials = true

@ -17,6 +17,7 @@ import {
} from "../../utils/auth"; } from "../../utils/auth";
// import { $NOT_NETWORK } from '../../utils/errorCode' // import { $NOT_NETWORK } from '../../utils/errorCode'
import {Message} from "element-ui"; import {Message} from "element-ui";
import md5 from 'js-md5';
import {RECEIVE_LOCINVCODE, RECEIVE_LOCINVNAME, RECEIVE_LOCSUBINVCODE, RECEIVE_LOCSUBINVNAME} from "../mutation-types"; import {RECEIVE_LOCINVCODE, RECEIVE_LOCINVNAME, RECEIVE_LOCSUBINVCODE, RECEIVE_LOCSUBINVNAME} from "../mutation-types";
// initial state // initial state
@ -58,7 +59,7 @@ const actions = {
// 用户名登录 // 用户名登录
loginName({commit}, userInfo) { loginName({commit}, userInfo) {
const userName = userInfo.userName ? userInfo.userName.trim() : ""; const userName = userInfo.userName ? userInfo.userName.trim() : "";
const pwd = userInfo.pwd ? userInfo.pwd : ""; const pwd = md5(userInfo.pwd);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
loginName(userName, pwd) loginName(userName, pwd)
.then(response => { .then(response => {

Loading…
Cancel
Save