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
3dbcbfe8
Commit
3dbcbfe8
authored
5 months ago
by
周宏民
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pref: 登录验证码改为后端较验
parent
5e688ed5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
28 deletions
+63
-28
index.js
src/api/index.js
+1
-0
base.js
src/api/service/base.js
+13
-1
LoginItem.js
src/pages/user/login/components/Login/LoginItem.js
+44
-25
login.js
src/pages/user/login/login.js
+5
-2
No files found.
src/api/index.js
View file @
3dbcbfe8
...
...
@@ -15,6 +15,7 @@ instanceRequest.transformRequestURL = function(url) {
'/PandaOMS/OMS/WebSite/GetConfig'
,
'/PandaOMS/OMS/CheckFreeLogin'
,
'/PandaCore/GCK/BussinessAuth/HDAuthLogin'
,
'/PandaCore/Identity/GetAliyunSMSVerificationCode'
,
];
if
(
excludeURL
.
includes
(
url
))
{
return
url
.
replace
(
/PandaCore
\/
GateWay
\/
/
,
''
);
...
...
This diff is collapsed.
Click to expand it.
src/api/service/base.js
View file @
3dbcbfe8
...
...
@@ -18,7 +18,9 @@ export const API = {
GET_CITY
:
process
.
env
.
NODE_ENV
!==
'production'
?
'/cityjson?ie=utf-8'
:
'https://pv.sohu.com'
,
GET_ALL_GROUPS_INFO_FORUSER
:
'/PandaCore/GCK/CloudPlat/GetAllGroupsInfoForUser'
,
GET_WEATHER
:
'/CityInterface/rest/services/CountyProduct.svc/GetWeather'
,
SEND_MESSAGE_CODE
:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode'
,
SEND_MESSAGE_CODE
:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode'
,
// 获取验证码 前端校验
GetAliyunSMSVerificationCodeHasWay
:
'/PandaCore/Identity/GetAliyunSMSVerificationCode'
,
// 获取验证码 走网关
GetAliyunSMSVerificationCode
:
'PandaCore/GCK/BussinessAuth/GetAliyunSMSVerificationCode'
,
// 获取验证码 不走网关
CHANGE_PASSWORD
:
'cityinterface/rest/services.svc/changepassword'
,
CHANGE_PASSWORD_SAFE
:
'/PandaOMS/OMS/UserCenter/UpdateUserPassword'
,
HD_AUTH_LOGIN
:
'/PandaCore/GCK/BussinessAuth/HDAuthLogin'
,
...
...
@@ -177,6 +179,16 @@ const services = {
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
GetAliyunSMSVerificationCodeHasWay
:
{
url
:
API
.
GetAliyunSMSVerificationCodeHasWay
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
GetAliyunSMSVerificationCode
:
{
url
:
API
.
GetAliyunSMSVerificationCode
,
method
:
constants
.
REQUEST_METHOD_GET
,
type
:
constants
.
REQUEST_HTTP
,
},
updateAvatar
:
{
url
:
API
.
UPDATE_AVATAR
,
method
:
constants
.
REQUEST_METHOD_GET
,
...
...
This diff is collapsed.
Click to expand it.
src/pages/user/login/components/Login/LoginItem.js
View file @
3dbcbfe8
...
...
@@ -139,21 +139,41 @@ const LoginItem = props => {
const
onGetCaptcha
=
useCallback
(
mobile
=>
{
// eslint-disable-next-line no-undef
appService
.
sendMessVerificationCode
({
phoneNumber
:
mobile
,
ignoreSite
:
true
,
cacheBust
:
true
,
})
.
then
(
res
=>
{
if
(
res
)
{
setExt
(
res
.
ext
);
setTiming
(
true
);
}
})
.
catch
(
error
=>
{
message
.
error
(
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.errorCodeMessage'
}));
});
if
(
window
.
globalConfig
?.
hasGateWay
)
{
// 开户网关
appService
.
GetAliyunSMSVerificationCodeHasWay
({
phoneNumber
:
mobile
,
ignoreSite
:
true
,
cacheBust
:
true
,
})
.
then
(
res
=>
{
if
(
res
)
{
setExt
(
res
.
ext
);
setTiming
(
true
);
}
})
.
catch
(
error
=>
{
message
.
error
(
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.errorCodeMessage'
}));
});
}
else
{
// 不开网关
appService
.
GetAliyunSMSVerificationCode
({
phoneNumber
:
mobile
,
ignoreSite
:
true
,
cacheBust
:
true
,
})
.
then
(
res
=>
{
if
(
res
)
{
setExt
(
res
.
ext
);
setTiming
(
true
);
}
})
.
catch
(
error
=>
{
message
.
error
(
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.errorCodeMessage'
}));
});
}
},
[]);
useEffect
(()
=>
{
...
...
@@ -183,18 +203,17 @@ const LoginItem = props => {
if
(
type
===
'Captcha'
)
{
const
inputProps
=
omit
(
otherProps
,
[
'onGetCaptcha'
,
'countDown'
]);
const
equalsValidate
=
(
rule
,
value
)
=>
{
if
(
value
===
ext
||
value
===
'8888'
)
{
return
Promise
.
resolve
();
}
// eslint-disable-next-line prefer-promise-reject-errors
return
Promise
.
reject
(
intl
.
formatMessage
({
id
:
'pages.login.phoneLogin.errorMessage'
}));
};
// const equalsValidate = (rule, value) => {
// if (value === ext || value === '8888') {
// return Promise.resolve();
// }
// return Promise.reject(intl.formatMessage({ id: 'pages.login.phoneLogin.errorMessage' }));
// };
// eslint-disable-next-line no-shadow
const
rulesArr
=
[...
rules
];
rulesArr
.
push
({
validator
:
equalsValidate
,
});
//
rulesArr.push({
//
validator: equalsValidate,
//
});
delete
options
.
rules
;
return
(
...
...
This diff is collapsed.
Click to expand it.
src/pages/user/login/login.js
View file @
3dbcbfe8
...
...
@@ -1375,7 +1375,7 @@ class Login {
}
}
login
(
usr
,
pwd
,
userPhone
,
isRememberPWD
,
mode
=
SERVICE_APP_LOGIN_MODE
.
password
)
{
login
(
usr
,
pwd
,
userPhone
,
isRememberPWD
,
mode
=
SERVICE_APP_LOGIN_MODE
.
password
,
captcha
)
{
this
.
globalConfig
=
getGlobalConfig
();
const
self
=
this
;
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
)
{
...
...
@@ -1391,6 +1391,7 @@ class Login {
:
''
,
type
:
mode
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
vcode
:
captcha
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
...
...
@@ -1442,6 +1443,8 @@ class Login {
ignoreSite
:
true
,
loginName
:
usr
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
vcode
:
captcha
,
})
.
then
(
response
=>
{
if
(
response
?.
msg
===
'密码过期'
)
{
...
...
@@ -1633,7 +1636,7 @@ class Login {
}
phoneLoginFormHandler
(
userPhone
,
captcha
)
{
this
.
login
(
''
,
''
,
userPhone
,
''
,
SERVICE_APP_LOGIN_MODE
.
phone
);
this
.
login
(
''
,
''
,
userPhone
,
''
,
SERVICE_APP_LOGIN_MODE
.
phone
,
captcha
);
}
slideVerify
(
ref
,
onSuccess
,
onFail
,
onRefresh
)
{
...
...
This diff is collapsed.
Click to expand it.
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