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