Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
intel_promotion_uniapp
Project
Project
Details
Activity
Releases
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
刘怀志
intel_promotion_uniapp
Commits
05ed80b9
Commit
05ed80b9
authored
Jul 11, 2024
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改密码加密传参
parent
9cddef2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
+28
-7
updatePwd.vue
setting/setting/updatePwd.vue
+9
-3
jsencrypt.js
store/jsencrypt.js
+19
-4
No files found.
setting/setting/updatePwd.vue
View file @
05ed80b9
...
...
@@ -20,6 +20,8 @@
</
template
>
<
script
>
import
{
encryptTwo
}
from
"../../store/jsencrypt"
;
import
Qs
from
'qs'
export
default
{
data
()
{
return
{
...
...
@@ -51,14 +53,18 @@
this
.
$u
.
toast
(
'前后密码不一致'
);
return
;
}
this
.
$u
.
put
(
'/system/user/updatePwd?oldPassword='
+
this
.
oldPassword
+
'&newPassword='
+
this
.
password
).
then
(
res
=>
{
const
params
=
Qs
.
stringify
(
{
oldPassword
:
encryptTwo
(
this
.
oldPassword
),
newPassword
:
encryptTwo
(
this
.
password
),
}
)
this
.
$u
.
put
(
'/system/user/updatePwd'
,
params
).
then
(
res
=>
{
this
.
$u
.
vuex
(
'vuex_token'
,
''
)
this
.
$u
.
vuex
(
'vuex_avatar'
,
''
)
this
.
$u
.
vuex
(
'vuex_user'
,
{
nickName
:
'未登录'
});
this
.
$u
.
vuex
(
'vuex_unit'
,[])
this
.
$u
.
route
({
url
:
'/login/login/passwordLogin'
,
params
:
{}
...
...
@@ -67,7 +73,7 @@
console
.
log
(
"err"
,
res
);
this
.
$u
.
toast
(
res
.
msg
);
})
},
},
goPage
(
url
)
{
this
.
$u
.
route
({
url
:
url
...
...
store/jsencrypt.js
View file @
05ed80b9
import
{
JSEncrypt
}
from
'jsencrypt'
// import JSEncrypt from 'jsencrypt/bin/jsencrypt'
// import JSEncrypt
New
from 'jsencrypt/bin/jsencrypt'
// key 是 加密公钥,我是登录的时候获取
const
key
=
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6EsPHTuCzwyZ7D0/OhW
\
n'
+
'QDQdB9tByC0vDnb7k7gmT0h77/mmJYcwvuqUdj+PXKO+V1NlJJqlf61UjcQkWD9o
\
n'
+
...
...
@@ -16,10 +16,10 @@ export function rsaEncrypt (data) {
encryptor
.
setPublicKey
(
key
)
return
encryptor
.
encrypt
(
json
)
}
// 解密私钥
const
privateKey
=
``
// 解密
export
function
rsaDecrypt
(
msg
)
{
const
decrypt
=
new
JSEncrypt
()
...
...
@@ -52,6 +52,14 @@ const urlPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzr+ftfseJxl3XD
'qpMhMERk00QMG3Vd6SJ65ch2Xr7x73I3SIwNOq8TJby/c3yB4Q38nOeJbjbiV99fo6HYqKr11/jsALjHANCO/4hkAkLqGhT'
+
'jAnBB2EYcGU6ruf4iKDuyek5gl8N/Klt8IkP6eVbMcQIDAQAB'
const
publicKey
=
'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6EsPHTuCzwyZ7D0/OhW
\
n'
+
'QDQdB9tByC0vDnb7k7gmT0h77/mmJYcwvuqUdj+PXKO+V1NlJJqlf61UjcQkWD9o
\
n'
+
'K6M1MHLHlS1qWXeXGaETClNUXAhdw2IkdBouXSHxyDkXYIDINYlOd91chxEBuBac
\
n'
+
'igJI0c5p9BA62QcOKDUE2mDJL+LOd70NCYsJf3um1IAgfKDX8RH2H3aPxy/BJ8aS
\
n'
+
'Edu+M9YDWsF6VFpaBr/WPPdouuPPjfs5203PCbvp0pvco+05JNDSiurEFcL+VDMm
\
n'
+
'wFNKExmeCvn/zr+UIkRPWHwxfJq+/gw/lt+UzBO2NURhCv4pQZy19vdFLLLeMM09
\
n'
+
'ewIDAQAB'
// 视频,pdf加密
export
function
urlEncrypt
(
txt
)
{
const
encryptor
=
new
JSEncrypt
()
...
...
@@ -66,3 +74,10 @@ export function urlDecrypt(txt) {
return
encryptor
.
decrypt
(
txt
)
}
export
function
encryptTwo
(
data
)
{
const
json
=
data
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
publicKey
)
return
encryptor
.
encrypt
(
json
)
}
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