Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
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
ReactWeb5
CivWeb
Commits
deaaeb97
Commit
deaaeb97
authored
Dec 19, 2024
by
李纪文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 密码前端正则校验
parent
77b8a7ad
Pipeline
#94757
waiting for manual action with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
reducer.js
src/containers/App/store/reducer.js
+4
-0
login.js
src/pages/user/login/login.js
+18
-0
No files found.
src/containers/App/store/reducer.js
View file @
deaaeb97
...
...
@@ -101,6 +101,10 @@ const appReducer = (state = initialState, action) => {
?
action
.
data
.
VerificationConfig
?.
VerificationCodeType
||
''
:
''
;
// temp.isVerificationCode 为false 时,不能用短信验证码
// 密码校验
temp
.
PasswordAuth
=
action
.
data
.
PasswordAuth
||
'否'
;
temp
.
PasswordRule
=
action
.
data
.
PasswordRule
||
''
;
temp
.
PasswordTip
=
action
.
data
.
PasswordTip
||
''
;
window
.
globalConfig
=
temp
;
// eslint-disable-next-line no-undef
...
...
src/pages/user/login/login.js
View file @
deaaeb97
...
...
@@ -1550,8 +1550,25 @@ class Login {
}
}
passwordAuthVerify
(
pwd
)
{
const
self
=
this
;
let
authTitle
=
null
;
try
{
if
(
self
?.
globalConfig
?.
PasswordAuth
===
'是'
&&
self
?.
globalConfig
?.
PasswordRule
)
{
const
reg
=
new
RegExp
(
self
.
globalConfig
.
PasswordRule
);
const
passwordTip
=
self
?.
globalConfig
?.
PasswordTip
||
'您的密码不符合规则,请重新输入'
;
authTitle
=
reg
.
test
(
pwd
)
?
null
:
passwordTip
;
}
}
catch
(
err
)
{
};
if
(
authTitle
)
{
message
.
error
(
authTitle
);
throw
`密码:
${
authTitle
}
`
;
}
}
loginHandler
(
user
,
pwd
,
userPhone
,
isRememberPWD
,
ref
)
{
const
self
=
this
;
self
.
passwordAuthVerify
(
pwd
);
if
(
user
&&
pwd
)
{
if
(
self
.
loginFailed
&&
self
.
captchaObj
)
{
self
.
captchaObj
.
verify
();
...
...
@@ -1567,6 +1584,7 @@ class Login {
loginHandlerValidate
(
user
,
pwd
,
userPhone
,
isRememberPWD
,
ref
,
validateCode
=
''
)
{
const
self
=
this
;
self
.
passwordAuthVerify
(
pwd
);
// isVerification 取自系统配置表,isVerificationCode 取自 站点配置,isVerificationCode为1 会默认把 isVerificationCode改为true
if
((
this
.
globalConfig
?.
isVerification
||
0
)
*
1
===
1
||
this
.
globalConfig
.
isVerificationCode
)
return
self
.
loginValidate
(
user
,
pwd
,
userPhone
,
isRememberPWD
,
SERVICE_APP_LOGIN_MODE
.
password
,
validateCode
);
...
...
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