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
402d6c0c
Commit
402d6c0c
authored
Dec 22, 2023
by
杨思琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 登录过期修改
parent
13d1758b
Pipeline
#83434
passed with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
14 deletions
+46
-14
base.js
src/api/service/base.js
+8
-2
index.js
src/components/Container/ValidDefaultPWD/index.js
+22
-11
actions.js
src/containers/App/store/actions.js
+1
-0
login.js
src/pages/user/login/login.js
+15
-1
No files found.
src/api/service/base.js
View file @
402d6c0c
...
...
@@ -20,6 +20,7 @@ export const API = {
GET_WEATHER
:
'/CityInterface/rest/services/CountyProduct.svc/GetWeather'
,
SEND_MESSAGE_CODE
:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode'
,
CHANGE_PASSWORD
:
'cityinterface/rest/services.svc/changepassword'
,
CHANGE_PASSWORD_SAFE
:
'/PandaOMS/OMS/UserCenter/UpdateUserPassword'
,
HD_AUTH_LOGIN
:
'/PandaCore/GCK/BussinessAuth/HDAuthLogin'
,
IOT_CHANGE_PASSWORD
:
'CityInterface/rest/services/OMS.svc/U_UpdatePasswordQuickGCK'
,
FILE_DOWNLOAD
:
'/cityinterface/rest/services/filedownload.svc/download'
,
...
...
@@ -171,8 +172,13 @@ const services = {
(
window
.
globalConfig
.
loginTemplate
===
'Dark - IOTMultiLogin.html'
||
window
.
globalConfig
.
loginTemplate
===
'新春 - 智联.html'
)
?
API
.
IOT_CHANGE_PASSWORD
:
API
.
CHANGE_PASSWORD
,
method
:
constants
.
REQUEST_METHOD_GET
,
:
API
.
CHANGE_PASSWORD_SAFE
,
method
:
window
.
globalConfig
&&
(
window
.
globalConfig
.
loginTemplate
===
'Dark - IOTMultiLogin.html'
||
window
.
globalConfig
.
loginTemplate
===
'新春 - 智联.html'
)
?
constants
.
REQUEST_METHOD_GET
:
constants
.
REQUEST_METHOD_POST
,
type
:
constants
.
REQUEST_HTTP
,
},
// Sensor 指标管理
...
...
src/components/Container/ValidDefaultPWD/index.js
View file @
402d6c0c
/* eslint-disable prettier/prettier */
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Modal
,
message
,
Form
,
Input
}
from
'antd'
;
import
{
ExclamationCircleFilled
}
from
'@ant-design/icons'
;
...
...
@@ -5,6 +6,7 @@ import { connect } from 'react-redux';
import
globalHeader
from
'@wisdom-utils/components/lib/AppLayout/locales/zh-CN/globalHeader'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
appService
}
from
'@/api'
;
import
{
encipher
}
from
'@wisdom-utils/utils/lib/helpers'
;
import
styles
from
'./index.less'
;
const
formItemLayout
=
{
labelCol
:
{
...
...
@@ -12,12 +14,16 @@ const formItemLayout = {
sm
:
{
span
:
6
},
},
};
const
getIOT
=
()
=>
window
.
globalConfig
.
loginTemplate
===
'Dark - IOTMultiLogin.html'
||
window
.
globalConfig
.
loginTemplate
===
'新春 - 智联.html'
;
/**
* 云平台上判断是否是默认密码
* 如果是默认密码,强制要求修改密码
*/
const
ValidContainer
=
props
=>
{
const
[
needChangePassword
,
setNeedChangePassword
]
=
useState
(
false
);
const
needChange
=
Boolean
(
localStorage
.
getItem
(
'password_needChange'
));
const
[
needChangePassword
,
setNeedChangePassword
]
=
useState
(
needChange
||
false
);
const
[
form
]
=
Form
.
useForm
();
// eslint-disable-next-line react/no-this-in-sfc
let
rules
=
localStorage
.
getItem
(
'password_pwdRegex'
)
?
localStorage
.
getItem
(
'password_pwdRegex'
)
:
''
;
...
...
@@ -48,24 +54,29 @@ const ValidContainer = props => {
form
.
validateFields
()
.
then
(
res
=>
{
const
params
=
{
password
:
res
.
oldPwd
,
// 拼接默认密码
newpassword
:
res
.
newPwd
,
token
:
window
.
globalConfig
.
token
,
ignoreSite
:
true
,
};
const
params
=
getIOT
()
?
{
newPassword
:
res
.
newPwd
,
phone
:
window
.
globalConfig
.
userInfo
.
Phone
,
}
:
{
OldPassWord
:
encipher
(
res
.
oldPwd
,
window
.
globalConfig
.
encrypt
).
toUpperCase
(),
NewPassWord
:
encipher
(
res
.
newPwd
,
window
.
globalConfig
.
encrypt
).
toUpperCase
(),
UserId
:
window
.
globalConfig
.
userInfo
.
OID
,
};
appService
.
changePassword
(
params
)
// eslint-disable-next-line no-shadow
.
then
(
res
=>
{
if
(
res
.
success
)
{
if
(
res
.
msg
===
''
||
res
.
msg
===
'Ok'
||
res
.
success
)
{
message
.
success
(
globalHeader
[
'component.account.password.update.success'
]);
setTimeout
(()
=>
{
setNeedChangePassword
(
false
);
localStorage
.
removeItem
(
'password_needChange'
);
// props.logout();
},
300
);
}
else
{
message
.
error
(
globalHeader
[
'component.account.oldpassword.errorMessage'
]
);
message
.
error
(
res
.
msg
);
}
})
.
catch
(
error
=>
{
...
...
@@ -88,12 +99,12 @@ const ValidContainer = props => {
cancelText
=
"取消"
okText
=
"确定"
onOk
=
{
handleOK
}
onCancel
=
{
event
=>
message
.
info
(
'用户首次登录之前必须修改密码'
)}
onCancel
=
{
event
=>
message
.
info
(
needChange
?
'密码过期,登录之前必须修改密码'
:
'用户首次登录之前必须修改密码'
)}
// zIndex={2000}
>
<
div
className
=
{
styles
[
'info-label'
]}
>
<
ExclamationCircleFilled
style
=
{{
color
:
'#FCAC0F'
,
fontSize
:
'16px'
}}
/
>
<
span
>
用户首次登录之前必须修改密码
<
/span
>
<
span
>
{
needChange
?
'密码过期,登录之前必须修改密码'
:
'用户首次登录之前必须修改密码'
}
<
/span
>
<
/div
>
<
Form
labelAlign
=
"left"
{...
formItemLayout
}
form
=
{
form
}
>
<
Form
.
Item
...
...
src/containers/App/store/actions.js
View file @
402d6c0c
...
...
@@ -224,6 +224,7 @@ export function logout(data) {
localStorage
.
removeItem
(
'password_token'
);
localStorage
.
removeItem
(
'password_pwdRegex'
);
localStorage
.
removeItem
(
'password_pwdRegexTip'
);
localStorage
.
removeItem
(
'password_needChange'
);
// eslint-disable-next-line no-undef,no-restricted-globals
createStoreage
.
remove
(
`__PANDA_STORE__
${
location
.
hostname
}
`
);
// eslint-disable-next-line no-undef,no-restricted-globals
...
...
src/pages/user/login/login.js
View file @
402d6c0c
...
...
@@ -4,7 +4,6 @@ import { log, params } from '@wisdom-utils/utils/lib/helpers';
import
{
message
}
from
'antd'
;
import
{
decode
,
encode
}
from
'js-base64'
;
import
Cookies
from
'js-cookie'
;
import
sha1
from
'sha1'
;
import
{
encipher
}
from
'@wisdom-utils/utils/lib/helpers'
;
import
{
SlideVerify
}
from
'@wisdom-utils/components'
;
import
{
appService
,
noticeService
}
from
'@/api'
;
...
...
@@ -391,6 +390,11 @@ class Login {
:
43200000
;
self
.
refreshToken
(
self
,
token
,
time
);
}
if
(
tokenRes
.
msg
===
'密码过期'
)
{
localStorage
.
setItem
(
'password_needChange'
,
true
);
}
else
{
localStorage
.
removeItem
(
'password_needChange'
);
}
}
self
.
updateConfig
(
self
.
globalConfig
);
})
...
...
@@ -1236,6 +1240,11 @@ class Login {
token
:
data
.
user_token
,
}),
);
if
(
res
.
msg
===
'密码过期'
)
{
localStorage
.
setItem
(
'password_needChange'
,
true
);
}
else
{
localStorage
.
removeItem
(
'password_needChange'
);
}
return
data
;
}
else
{
message
.
error
({
...
...
@@ -1267,6 +1276,11 @@ class Login {
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
})
.
then
(
response
=>
{
if
(
response
?.
msg
===
'密码过期'
)
{
localStorage
.
setItem
(
'password_needChange'
,
true
);
}
else
{
localStorage
.
removeItem
(
'password_needChange'
);
}
self
.
transformLoginHander
(
response
,
isRememberPWD
,
pwd
);
})
.
catch
(
error
=>
{
...
...
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