Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tea_resources_pc
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
张伯涛
tea_resources_pc
Commits
d3b7170f
Commit
d3b7170f
authored
Jul 01, 2024
by
张伯涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加密问题区分对象加密和单个字段加密
parent
e11e5776
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
jsencrypt.js
src/utils/jsencrypt.js
+8
-1
login.vue
src/views/login/login.vue
+1
-1
changePassword.vue
src/views/personalCenter/component/changePassword.vue
+3
-3
No files found.
src/utils/jsencrypt.js
View file @
d3b7170f
...
...
@@ -10,13 +10,20 @@ const publicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6EsPHTuCzwyZ7D0/
'wFNKExmeCvn/zr+UIkRPWHwxfJq+/gw/lt+UzBO2NURhCv4pQZy19vdFLLLeMM09
\
n'
+
'ewIDAQAB'
// 对象加密
export
function
encrypt
(
data
)
{
const
json
=
JSON
.
stringify
(
data
)
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
publicKey
)
return
encryptor
.
encrypt
(
json
)
}
// 单个字段加密
export
function
encryptTwo
(
data
)
{
const
json
=
data
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPublicKey
(
publicKey
)
return
encryptor
.
encrypt
(
json
)
}
export
function
decrypt
(
txt
)
{
const
encryptor
=
new
JSEncrypt
()
encryptor
.
setPrivateKey
(
''
)
...
...
src/views/login/login.vue
View file @
d3b7170f
...
...
@@ -369,7 +369,7 @@ export default {
}
}).
catch
(()
=>
{
this
.
loading
=
false
this
.
verify
=
fals
e
this
.
verify
=
tru
e
if
(
this
.
captchaType
===
'MATH'
||
this
.
captchaType
===
'CHAR'
)
{
this
.
getCode
()
}
...
...
src/views/personalCenter/component/changePassword.vue
View file @
d3b7170f
...
...
@@ -22,7 +22,7 @@
<
script
>
import
{
changePassword
}
from
'@/api/personalCenter'
import
{
encrypt
}
from
'@/utils/jsencrypt'
import
{
encrypt
Two
}
from
'@/utils/jsencrypt'
export
default
{
name
:
'ChangePassword'
,
data
()
{
...
...
@@ -59,8 +59,8 @@ export default {
if
(
valid
)
{
this
.
loading
=
true
const
params
=
{
oldPassword
:
encrypt
(
this
.
personalForm
.
oldPassword
),
newPassword
:
encrypt
(
this
.
personalForm
.
newPasswordTo
)
oldPassword
:
encrypt
Two
(
this
.
personalForm
.
oldPassword
),
newPassword
:
encrypt
Two
(
this
.
personalForm
.
newPasswordTo
)
}
changePassword
(
params
).
then
(
res
=>
{
if
(
res
.
code
===
200
)
{
...
...
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