Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
bc6030d8
Commit
bc6030d8
authored
Jun 06, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encryption
parent
0fc9a0ec
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
47 deletions
+18
-47
src/App.js
+0
-1
src/components/passport/accountLogin/index.js
+4
-9
src/components/passport/encryption/index.js
+7
-3
src/components/passport/store/actions.js
+0
-13
src/components/passport/store/reducers.js
+0
-21
src/utils/proxy-config.js
+7
-0
No files found.
src/App.js
View file @
bc6030d8
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'
...
...
src/components/passport/accountLogin/index.js
View file @
bc6030d8
...
...
@@ -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
)
src/components/passport/encryption/index.js
View file @
bc6030d8
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
)
{
...
...
src/components/passport/store/actions.js
View file @
bc6030d8
export
const
login
=
(
userInfo
)
=>
({
type
:
'LOGIN'
,
userInfo
})
export
const
logout
=
()
=>
({
type
:
'LOGOUT'
})
export
const
requestLogin
=
payload
=>
dispatch
=>
{
}
\ No newline at end of file
src/components/passport/store/reducers.js
View file @
bc6030d8
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
src/utils/proxy-config.js
View file @
bc6030d8
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment