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
57ce78e9
Commit
57ce78e9
authored
Apr 27, 2025
by
徐乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 修改
parent
b9c76e1c
Pipeline
#97115
passed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
38 deletions
+52
-38
login.js
src/pages/user/login/login.js
+17
-34
noSecret.js
src/pages/user/login/noSecret.js
+35
-4
No files found.
src/pages/user/login/login.js
View file @
57ce78e9
...
@@ -10,7 +10,6 @@ import { getUserInfo, getWebSiteConfig } from '@/api/service/base';
...
@@ -10,7 +10,6 @@ import { getUserInfo, getWebSiteConfig } from '@/api/service/base';
import
{
SERVICE_APP_LOGIN_MODE
,
SERVICE_INTERFACE_SUCCESS_CODE
,
WX_REDIRECT_URI
}
from
'@/constants'
;
import
{
SERVICE_APP_LOGIN_MODE
,
SERVICE_INTERFACE_SUCCESS_CODE
,
WX_REDIRECT_URI
}
from
'@/constants'
;
import
store
from
'@/stores'
;
import
store
from
'@/stores'
;
import
{
defaultApp
}
from
'@/micro'
;
import
{
defaultApp
}
from
'@/micro'
;
import
CryptoJS
from
'crypto-js'
;
import
{
import
{
DEFAULT_MQTT_PATH
,
DEFAULT_MQTT_PATH
,
...
@@ -37,38 +36,21 @@ class Login {
...
@@ -37,38 +36,21 @@ class Login {
// 单点登录_xule_20231214
// 单点登录_xule_20231214
const
queryString
=
window
.
location
.
search
.
substring
(
1
);
const
queryString
=
window
.
location
.
search
.
substring
(
1
);
const
params
=
queryString
.
split
(
'&'
);
const
params
=
queryString
.
split
(
'&'
);
const
paramsFind
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
==
'uniwater_utoken'
;
});
const
paramsFind
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
==
'uniwater_utoken'
;
});
this
.
uniwater_utoken
=
paramsFind
?.
split
(
'='
)[
1
]
??
''
;
this
.
uniwater_utoken
=
paramsFind
?.
split
(
'='
)[
1
]
??
''
;
// 单页面免登重定向地址
// 单页面免登重定向地址
const
redirect
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'redirect'
;
});
const
redirect
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'redirect'
;
});
if
(
this
.
uniwater_utoken
&&
!
redirect
)
{
if
(
this
.
uniwater_utoken
&&
!
redirect
)
{
this
.
getTokenForThird
();
this
.
getTokenForThird
();
}
}
//第三方免密登录,通过账号加密的方式,链接有效期30s_xule_20250427
const
loginName
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'loginName'
;
})?.
split
(
'='
)[
1
]
||
''
;
if
(
loginName
)
{
const
generateType
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'type'
;
})?.
split
(
'='
)[
1
]
||
''
;
const
initiateTime
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'time'
;
})?.
split
(
'='
)[
1
]
||
''
;
const
eiv
=
params
&&
params
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'key'
;
})?.
split
(
'='
)[
1
]
||
''
;
let
newTime
=
new
Date
().
getTime
()
-
initiateTime
*
1
;
if
(
generateType
==
'pandaoa'
&&
newTime
>
0
&&
newTime
<
30000
&&
eiv
)
{
const
key
=
CryptoJS
.
PBKDF2
(
initiateTime
,
''
,
{
keySize
:
256
/
32
,
iterations
:
100000
});
const
iv
=
CryptoJS
.
enc
.
Hex
.
parse
(
eiv
);
const
decrypted
=
CryptoJS
.
AES
.
decrypt
(
loginName
,
key
,
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
const
enLoginName
=
decrypted
.
toString
(
CryptoJS
.
enc
.
Utf8
);
this
.
login
(
enLoginName
,
''
,
''
,
false
,
'password'
,
''
,
generateType
);
return
;
}
}
this
.
createContext
=
props
.
createContext
;
this
.
createContext
=
props
.
createContext
;
this
.
history
=
props
.
history
;
this
.
history
=
props
.
history
;
...
@@ -373,7 +355,7 @@ class Login {
...
@@ -373,7 +355,7 @@ class Login {
?
this
.
globalConfig
.
userInfo
.
fullName
?
this
.
globalConfig
.
userInfo
.
fullName
:
''
,
:
''
,
})
})
.
catch
(
error
=>
{
});
.
catch
(
error
=>
{});
}
}
if
(
window
.
location
.
host
===
'panda-water.com'
)
{
if
(
window
.
location
.
host
===
'panda-water.com'
)
{
...
@@ -387,7 +369,7 @@ class Login {
...
@@ -387,7 +369,7 @@ class Login {
?
this
.
globalConfig
.
userInfo
.
fullName
?
this
.
globalConfig
.
userInfo
.
fullName
:
''
,
:
''
,
})
})
.
catch
(
error
=>
{
});
.
catch
(
error
=>
{});
}
}
}
}
...
@@ -572,7 +554,8 @@ class Login {
...
@@ -572,7 +554,8 @@ class Login {
mqttConfig
.
mqtt_mess
.
TcpPort
=
DEFAULT_TCP_PORT
;
mqttConfig
.
mqtt_mess
.
TcpPort
=
DEFAULT_TCP_PORT
;
mqttConfig
.
mqtt_IsSSL
=
`
${
mqttConfig
.
mqtt_mess
.
TcpIP
}
:
${
mqttConfig
.
mqtt_mess
.
TcpPort
}
`
;
mqttConfig
.
mqtt_IsSSL
=
`
${
mqttConfig
.
mqtt_mess
.
TcpIP
}
:
${
mqttConfig
.
mqtt_mess
.
TcpPort
}
`
;
}
}
mqttConfig
.
mqtt_iotIP
=
`
${
mqttConfig
.
mqtt_mess
.
TcpIP
}
:
${
mqttConfig
.
mqtt_mess
.
TcpPort
?
mqttConfig
.
mqtt_mess
.
TcpPort
:
'443'
mqttConfig
.
mqtt_iotIP
=
`
${
mqttConfig
.
mqtt_mess
.
TcpIP
}
:
${
mqttConfig
.
mqtt_mess
.
TcpPort
?
mqttConfig
.
mqtt_mess
.
TcpPort
:
'443'
}
`
;
}
`
;
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
{
self
.
globalConfig
=
Object
.
assign
(
self
.
globalConfig
,
{
...
mqttConfig
,
...
mqttConfig
,
...
@@ -1028,7 +1011,7 @@ class Login {
...
@@ -1028,7 +1011,7 @@ class Login {
height
:
'400'
,
height
:
'400'
,
});
});
const
handleMessage
=
function
(
event
)
{
const
handleMessage
=
function
(
event
)
{
const
{
origin
}
=
event
;
const
{
origin
}
=
event
;
// Logger.log('origin', event.origin);
// Logger.log('origin', event.origin);
if
(
origin
===
'https://login.dingtalk.com'
)
{
if
(
origin
===
'https://login.dingtalk.com'
)
{
...
@@ -1401,7 +1384,7 @@ class Login {
...
@@ -1401,7 +1384,7 @@ class Login {
}
}
}
}
login
(
usr
,
pwd
,
userPhone
,
isRememberPWD
,
mode
=
SERVICE_APP_LOGIN_MODE
.
password
,
captcha
,
generateType
)
{
login
(
usr
,
pwd
,
userPhone
,
isRememberPWD
,
mode
=
SERVICE_APP_LOGIN_MODE
.
password
,
captcha
)
{
this
.
globalConfig
=
getGlobalConfig
();
this
.
globalConfig
=
getGlobalConfig
();
const
self
=
this
;
const
self
=
this
;
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
)
{
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
)
{
...
@@ -1416,7 +1399,7 @@ class Login {
...
@@ -1416,7 +1399,7 @@ class Login {
:
encipher
(
pwd
,
this
.
globalConfig
.
encrypt
).
toUpperCase
()
:
encipher
(
pwd
,
this
.
globalConfig
.
encrypt
).
toUpperCase
()
:
''
,
:
''
,
type
:
mode
,
type
:
mode
,
generateType
:
params
.
getParams
(
'generateType'
)
||
generateType
||
''
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
vcode
:
captcha
,
vcode
:
captcha
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
...
...
src/pages/user/login/noSecret.js
View file @
57ce78e9
...
@@ -12,9 +12,10 @@ import { actionCreators } from '@/containers/App/store';
...
@@ -12,9 +12,10 @@ import { actionCreators } from '@/containers/App/store';
import
{
appService
}
from
'@/api'
;
import
{
appService
}
from
'@/api'
;
import
LoginAction
from
'./login'
;
import
LoginAction
from
'./login'
;
import
{
defaultApp
}
from
'../../../micro'
;
import
{
defaultApp
}
from
'../../../micro'
;
import
CryptoJS
from
'crypto-js'
;
const
Login
=
forwardRef
((
props
,
_ref
)
=>
{
const
Login
=
forwardRef
((
props
,
_ref
)
=>
{
const
history
=
useHistory
();
const
history
=
useHistory
();
const
[
action
,
setAction
]
=
useState
(()
=>
new
LoginAction
(
Object
.
assign
({},
props
,
{
history
}),
()
=>
{},
false
));
const
[
action
,
setAction
]
=
useState
(()
=>
new
LoginAction
(
Object
.
assign
({},
props
,
{
history
}),
()
=>
{
},
false
));
const
[
jumpParam
]
=
useState
(()
=>
{
const
[
jumpParam
]
=
useState
(()
=>
{
const
param
=
params
const
param
=
params
.
getParams
(
'jumpParam'
)
.
getParams
(
'jumpParam'
)
...
@@ -42,6 +43,35 @@ const Login = forwardRef((props, _ref) => {
...
@@ -42,6 +43,35 @@ const Login = forwardRef((props, _ref) => {
const
authRes
=
hdtoken
?
await
appService
.
AuthHDUSer
({
token
:
hdtoken
,
ignoreSite
:
true
})
:
''
;
const
authRes
=
hdtoken
?
await
appService
.
AuthHDUSer
({
token
:
hdtoken
,
ignoreSite
:
true
})
:
''
;
return
authRes
?.
data
||
''
;
return
authRes
?.
data
||
''
;
};
};
const
decryptName
=
()
=>
{
//第三方免密登录,通过账号加密的方式,链接有效期30s_xule_20250427
const
queryString
=
window
.
location
.
search
.
substring
(
1
);
const
ps
=
queryString
.
split
(
'&'
);
const
loginName
=
ps
&&
ps
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'loginName'
;
})?.
split
(
'='
)[
1
]
||
''
;
if
(
loginName
)
{
const
generateType
=
ps
&&
ps
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'type'
;
})?.
split
(
'='
)[
1
]
||
''
;
const
initiateTime
=
ps
&&
ps
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'time'
;
})?.
split
(
'='
)[
1
]
||
''
;
const
eiv
=
ps
&&
ps
.
find
(
function
(
a
)
{
return
a
.
split
(
'='
)[
0
]
===
'key'
;
})?.
split
(
'='
)[
1
]
||
''
;
let
newTime
=
new
Date
().
getTime
()
-
initiateTime
*
1
;
if
(
generateType
==
'pandaoa'
&&
newTime
>
0
&&
newTime
<
30000
&&
eiv
)
{
const
key
=
CryptoJS
.
PBKDF2
(
initiateTime
,
''
,
{
keySize
:
256
/
32
,
iterations
:
100000
});
const
iv
=
CryptoJS
.
enc
.
Hex
.
parse
(
eiv
);
const
decrypted
=
CryptoJS
.
AES
.
decrypt
(
loginName
,
key
,
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
Pkcs7
});
const
enLoginName
=
decrypted
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
enLoginName
;
}
}
return
''
;
}
useEffect
(
async
()
=>
{
useEffect
(
async
()
=>
{
action
.
globalConfig
=
props
.
global
;
action
.
globalConfig
=
props
.
global
;
// eslint-disable-next-line no-prototype-builtins
// eslint-disable-next-line no-prototype-builtins
...
@@ -54,13 +84,14 @@ const Login = forwardRef((props, _ref) => {
...
@@ -54,13 +84,14 @@ const Login = forwardRef((props, _ref) => {
hasLogin
.
current
=
true
;
hasLogin
.
current
=
true
;
window
.
hasLogin
=
true
;
window
.
hasLogin
=
true
;
const
authData
=
!
token
?
await
getAuthDataInfo
()
:
''
;
const
authData
=
!
token
?
await
getAuthDataInfo
()
:
''
;
const
enLoginName
=
decryptName
();
const
isGZproject
=
window
.
globalConfig
.
subtitle
===
'广州节约用水管理系统'
;
const
isGZproject
=
window
.
globalConfig
.
subtitle
===
'广州节约用水管理系统'
;
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
&&
!
isGZproject
)
{
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
&&
!
isGZproject
)
{
appService
appService
.
authorizationToken
({
.
authorizationToken
({
loginName
:
token
||
authData
,
loginName
:
token
||
authData
||
enLoginName
,
type
:
'token'
,
type
:
'token'
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
generateType
:
params
.
getParams
(
'generateType'
)
||
(
enLoginName
?
'pandaoa'
:
''
)
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
...
@@ -112,7 +143,7 @@ const Login = forwardRef((props, _ref) => {
...
@@ -112,7 +143,7 @@ const Login = forwardRef((props, _ref) => {
:
''
;
:
''
;
const
param
=
JSON
.
parse
(
jumpParam
);
const
param
=
JSON
.
parse
(
jumpParam
);
if
(
param
)
window
.
sessionStorage
.
setItem
(
'routerParams'
,
JSON
.
stringify
(
param
));
if
(
param
)
window
.
sessionStorage
.
setItem
(
'routerParams'
,
JSON
.
stringify
(
param
));
}
catch
(
error
)
{}
}
catch
(
error
)
{
}
// props.history.push('/' + params.getParams('redirect'))
// props.history.push('/' + params.getParams('redirect'))
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
`
);
props
.
history
.
push
(
`/?client=
${
props
.
global
.
client
}
`
);
// window.share.event.emit('triggerMicro', props.global);
// window.share.event.emit('triggerMicro', props.global);
...
...
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