Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
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
liyang
sts网站
Commits
9f97fd09
Commit
9f97fd09
authored
Nov 20, 2019
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加jsencrypt实现参数的前端加密
parent
3af0158d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
3 deletions
+35
-3
package.json
ruoyi-ui/package.json
+2
-1
jsencrypt.js
ruoyi-ui/src/utils/jsencrypt.js
+30
-0
login.vue
ruoyi-ui/src/views/login.vue
+3
-2
No files found.
ruoyi-ui/package.json
View file @
9f97fd09
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
"url"
:
"https://gitee.com/y_project/RuoYi-Vue.git"
"url"
:
"https://gitee.com/y_project/RuoYi-Vue.git"
},
},
"dependencies"
:
{
"dependencies"
:
{
"@riophae/vue-treeselect"
:
"0.
1
.0"
,
"@riophae/vue-treeselect"
:
"0.
4
.0"
,
"vue-quill-editor"
:
"3.0.6"
,
"vue-quill-editor"
:
"3.0.6"
,
"vue-cropper"
:
"0.4.9"
,
"vue-cropper"
:
"0.4.9"
,
"axios"
:
"0.18.1"
,
"axios"
:
"0.18.1"
,
...
@@ -48,6 +48,7 @@
...
@@ -48,6 +48,7 @@
"element-ui"
:
"2.11.1"
,
"element-ui"
:
"2.11.1"
,
"fuse.js"
:
"3.4.4"
,
"fuse.js"
:
"3.4.4"
,
"js-cookie"
:
"2.2.0"
,
"js-cookie"
:
"2.2.0"
,
"jsencrypt"
:
"3.0.0-rc.1"
,
"normalize.css"
:
"7.0.0"
,
"normalize.css"
:
"7.0.0"
,
"nprogress"
:
"0.2.0"
,
"nprogress"
:
"0.2.0"
,
"path-to-regexp"
:
"2.4.0"
,
"path-to-regexp"
:
"2.4.0"
,
...
...
ruoyi-ui/src/utils/jsencrypt.js
0 → 100644
View file @
9f97fd09
import
JSEncrypt
from
'jsencrypt/bin/jsencrypt'
// 密钥对生成 http://web.chacuo.net/netrsakeypair
const
publicKey
=
'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD
\
n'
+
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
const
privateKey
=
'MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8
\
n'
+
'mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9p
\
n'
+
'B6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue
\
n'
+
'/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZ
\
n'
+
'UBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6
\
n'
+
'vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha
\
n'
+
'4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3
\
n'
+
'tTbklZkD2A=='
// 加密
export
function
encrypt
(
txt
)
{
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
publicKey
)
// 设置公钥
return
encryptor
.
encrypt
(
txt
)
// 对需要加密的数据进行加密
}
// 解密
export
function
decrypt
(
txt
)
{
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPrivateKey
(
privateKey
)
return
encryptor
.
decrypt
(
txt
)
}
ruoyi-ui/src/views/login.vue
View file @
9f97fd09
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
<
script
>
<
script
>
import
{
getCodeImg
}
from
"@/api/login"
;
import
{
getCodeImg
}
from
"@/api/login"
;
import
Cookies
from
"js-cookie"
;
import
Cookies
from
"js-cookie"
;
import
{
encrypt
,
decrypt
}
from
'@/utils/jsencrypt'
export
default
{
export
default
{
name
:
"Login"
,
name
:
"Login"
,
...
@@ -108,7 +109,7 @@ export default {
...
@@ -108,7 +109,7 @@ export default {
const
rememberMe
=
Cookies
.
get
(
'rememberMe'
)
const
rememberMe
=
Cookies
.
get
(
'rememberMe'
)
this
.
loginForm
=
{
this
.
loginForm
=
{
username
:
username
===
undefined
?
this
.
loginForm
.
username
:
username
,
username
:
username
===
undefined
?
this
.
loginForm
.
username
:
username
,
password
:
password
===
undefined
?
this
.
loginForm
.
password
:
password
,
password
:
password
===
undefined
?
this
.
loginForm
.
password
:
decrypt
(
password
)
,
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
)
rememberMe
:
rememberMe
===
undefined
?
false
:
Boolean
(
rememberMe
)
};
};
},
},
...
@@ -118,7 +119,7 @@ export default {
...
@@ -118,7 +119,7 @@ export default {
this
.
loading
=
true
;
this
.
loading
=
true
;
if
(
this
.
loginForm
.
rememberMe
)
{
if
(
this
.
loginForm
.
rememberMe
)
{
Cookies
.
set
(
"username"
,
this
.
loginForm
.
username
,
{
expires
:
30
});
Cookies
.
set
(
"username"
,
this
.
loginForm
.
username
,
{
expires
:
30
});
Cookies
.
set
(
"password"
,
this
.
loginForm
.
password
,
{
expires
:
30
});
Cookies
.
set
(
"password"
,
encrypt
(
this
.
loginForm
.
password
)
,
{
expires
:
30
});
Cookies
.
set
(
'rememberMe'
,
this
.
loginForm
.
rememberMe
,
{
expires
:
30
});
Cookies
.
set
(
'rememberMe'
,
this
.
loginForm
.
rememberMe
,
{
expires
:
30
});
}
else
{
}
else
{
Cookies
.
remove
(
"username"
);
Cookies
.
remove
(
"username"
);
...
...
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