Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
source-trace-manage-go
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tracing
source-trace-manage-go
Commits
71af5fac
Commit
71af5fac
authored
Oct 12, 2021
by
zL
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:对密码设置进行正则校验
parent
b4f7c8fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
validate.js
src/utils/tool/validate.js
+6
-0
EditPassword.vue
src/views/userCenter/EditPassword.vue
+9
-4
SetPassword.vue
src/views/userCenter/SetPassword.vue
+9
-3
No files found.
src/utils/tool/validate.js
0 → 100644
View file @
71af5fac
// 8~20位包含数字、大小写字母
export
function
validPassword
(
pwd
)
{
const
reg
=
/^
(?=
.*
[
a-z
])(?=
.*
[
A-Z
])(?=
.*
\d)[^]{8,16}
$/
return
reg
.
test
(
pwd
)
}
src/views/userCenter/EditPassword.vue
View file @
71af5fac
...
...
@@ -41,6 +41,7 @@
</
template
>
<
script
>
import
Vue
from
"vue"
;
import
{
validPassword
}
from
"@/utils/tool/validate"
;
import
CodeBtn
from
"./VerCode.vue"
;
import
{
editPassword
}
from
"./Api.service"
;
export
default
Vue
.
extend
({
...
...
@@ -74,10 +75,15 @@ export default Vue.extend({
});
},
async
confirm
()
{
if
(
this
.
passwordForm
.
pwd
.
trim
()
===
""
)
{
this
.
$message
(
"密码不可为空"
);
// 密码格式校验
if
(
!
validPassword
(
this
.
passwordForm
.
pwd
))
{
this
.
$message
({
message
:
"用户密码错误"
,
type
:
"error"
,
});
return
;
}
else
if
(
this
.
passwordForm
.
code
.
trim
()
===
""
)
{
}
if
(
this
.
passwordForm
.
code
.
trim
()
===
""
)
{
this
.
$message
(
"验证码不可为空"
);
return
;
}
...
...
@@ -109,7 +115,6 @@ export default Vue.extend({
message
:
"密码修改成功"
,
type
:
"success"
,
});
// this.$notify.success(res.message);
this
.
$router
.
push
(
"/userCenter"
);
}
},
...
...
src/views/userCenter/SetPassword.vue
View file @
71af5fac
...
...
@@ -41,6 +41,7 @@
</
template
>
<
script
>
import
Vue
from
"vue"
;
import
{
validPassword
}
from
"@/utils/tool/validate"
;
import
CodeBtn
from
"./VerCode.vue"
;
import
{
editPassword
}
from
"./Api.service"
;
export
default
Vue
.
extend
({
...
...
@@ -74,10 +75,15 @@ export default Vue.extend({
});
},
async
confirm
()
{
if
(
this
.
passwordForm
.
pwd
.
trim
()
===
""
)
{
this
.
$message
(
"密码不可为空"
);
// 密码格式校验
if
(
!
validPassword
(
this
.
passwordForm
.
pwd
))
{
this
.
$message
({
message
:
"用户密码错误"
,
type
:
"error"
,
});
return
;
}
else
if
(
this
.
passwordForm
.
code
.
trim
()
===
""
)
{
}
if
(
this
.
passwordForm
.
code
.
trim
()
===
""
)
{
this
.
$message
(
"验证码不可为空"
);
return
;
}
...
...
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