Commit bc6030d8 by zhanghaozhe

encryption

parent 0fc9a0ec
import React, {Component} from 'react'
import Routes from './router'
import cookie from 'js-cookie'
import {api} from '@/utils'
//拦截ajax请求,返回mock数据
/*import mock from '@/utils/mock'
......
......@@ -2,6 +2,7 @@ import React, { Component } from "react"
import './accountLogin.scss'
import { Link } from "react-router-dom";
import { withFormik, FastField, Form } from "formik";
import { compose } from 'redux';
import Header from "../common/Header";
......@@ -10,17 +11,9 @@ import LoginButton from '../common/LoginButton'
import PasswordInput from '../common/passwordInput'
// import VeriCodeButton from '../common/veriCodeInput'
// import LoginWays from '../common/LoginWays'
import { encrypt, decrypt } from '@/components/passport/encryption';
class AccountLogin extends Component {
componentDidMount() {
}
render() {
return (
<div className={'account-login'}>
......@@ -69,4 +62,6 @@ const formikConfig = {
console.log(values)
}
}
export default withFormik(formikConfig)(AccountLogin)
export default compose(
withFormik(formikConfig)
)(AccountLogin)
import aes from 'crypto-js/aes'
import Crypto from 'crypto-js'
const key = 'C7D590D00FA968A261BDD5B6CD40DDC2C0561338BF8B9197'
const iv = '19513F90B7A8875E469E82195F90EE99'
const key = Crypto.enc.Hex.parse('C7D590D00FA968A261BDD5B6CD40DDC2C0561338BF8B9197')
const iv = Crypto.enc.Hex.parse('19513F90B7A8875E469E82195F90EE99')
function encrypt(message) {
return aes.encrypt(message, key, {iv}).toString()
return aes.encrypt(message, key, {
iv,
mode: Crypto.mode.CBC,
}).toString()
}
function decrypt(encrypted) {
......
export const login = (userInfo) => ({
type: 'LOGIN',
userInfo
})
export const logout = () => ({
type: 'LOGOUT'
})
export const requestLogin = payload => dispatch => {
}
\ No newline at end of file
const initialState = {
userName: '',
avatar: '',
uid: '',
isVIP: false
}
const userInfo = (state = initialState, action) => {
switch (action.type) {
case 'LOGIN':
return {
...state,
...action.userInfo
}
default:
return state
}
}
export default userInfo
\ No newline at end of file
......@@ -19,6 +19,12 @@ const config = {
secure: false,
}
},
'passport-api': {
development: '/passport-api',
test: 'http://passport-test.julyedu.com',
production: 'http://passport.julyedu.com',
proxy: {}
},
}
module.exports = config
\ No newline at end of file
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