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
27e5f99f
Commit
27e5f99f
authored
May 16, 2023
by
杨思琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 开启网关免登录修复
parent
a2c745dc
Pipeline
#72414
waiting for manual action with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
+46
-3
login.js
src/pages/user/login/login.js
+1
-1
noSecret.js
src/pages/user/login/noSecret.js
+45
-2
No files found.
src/pages/user/login/login.js
View file @
27e5f99f
...
@@ -990,7 +990,7 @@ class Login {
...
@@ -990,7 +990,7 @@ class Login {
reg
=
new
RegExp
(
rules
);
reg
=
new
RegExp
(
rules
);
}
}
let
check
=
false
;
let
check
=
false
;
if
(
rules
!==
''
)
check
=
!
reg
.
test
(
pwd
);
if
(
rules
!==
''
&&
pwd
)
check
=
!
reg
.
test
(
pwd
);
localStorage
.
setItem
(
'access_token'
,
response
.
access_token
?
response
.
access_token
:
''
);
localStorage
.
setItem
(
'access_token'
,
response
.
access_token
?
response
.
access_token
:
''
);
if
(
check
)
{
if
(
check
)
{
localStorage
.
setItem
(
'password_token'
,
response
.
access_token
?
response
.
access_token
:
''
);
localStorage
.
setItem
(
'password_token'
,
response
.
access_token
?
response
.
access_token
:
''
);
...
...
src/pages/user/login/noSecret.js
View file @
27e5f99f
/* eslint-disable no-prototype-builtins */
/* eslint-disable no-empty */
/* eslint-disable no-empty */
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable no-undef */
/* eslint-disable no-undef */
...
@@ -7,6 +8,7 @@ import React, { forwardRef, useEffect, useRef, useState } from 'react';
...
@@ -7,6 +8,7 @@ import React, { forwardRef, useEffect, useRef, useState } from 'react';
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
{
useHistory
}
from
'@wisdom-utils/runtime'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
actionCreators
}
from
'@/containers/App/store'
;
import
{
appService
}
from
'@/api'
;
import
LoginAction
from
'./login'
;
import
LoginAction
from
'./login'
;
import
{
defaultApp
}
from
'../../../micro'
;
import
{
defaultApp
}
from
'../../../micro'
;
const
Login
=
forwardRef
((
props
,
_ref
)
=>
{
const
Login
=
forwardRef
((
props
,
_ref
)
=>
{
...
@@ -16,15 +18,56 @@ const Login = forwardRef((props, _ref) => {
...
@@ -16,15 +18,56 @@ const Login = forwardRef((props, _ref) => {
const
param
=
params
.
getParams
(
'redirect'
)?.
replaceAll
(
';'
,
'&'
);
const
param
=
params
.
getParams
(
'redirect'
)?.
replaceAll
(
';'
,
'&'
);
return
param
?
decodeURIComponent
(
escape
(
param
))
:
null
;
return
param
?
decodeURIComponent
(
escape
(
param
))
:
null
;
});
});
const
[
token
]
=
useState
(()
=>
{
const
param
=
params
.
getParams
(
'token'
)?.
replaceAll
(
';'
,
'&'
);
return
param
?
decodeURIComponent
(
escape
(
param
))
:
null
;
});
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱
// 需要在 GetGateWay 和 GetConfig 之后再执行登录。避免信息错落乱
const
hasLogin
=
useRef
();
const
hasLogin
=
useRef
();
useEffect
(()
=>
{
useEffect
(()
=>
{
action
.
globalConfig
=
props
.
global
;
action
.
globalConfig
=
props
.
global
;
// eslint-disable-next-line no-prototype-builtins
// eslint-disable-next-line no-prototype-builtins
if
(
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'products'
)
&&
hasLogin
.
current
!==
true
)
{
if
(
props
.
global
&&
props
.
global
.
hasOwnProperty
(
'products'
)
&&
hasLogin
.
current
!==
true
&&
window
.
hasLogin
!==
true
)
{
hasLogin
.
current
=
true
;
hasLogin
.
current
=
true
;
action
.
init
();
window
.
hasLogin
=
true
;
if
(
window
.
globalConfig
&&
window
.
globalConfig
.
hasGateWay
)
{
appService
.
authorizationToken
({
loginName
:
token
,
type
:
'token'
,
generateType
:
params
.
getParams
(
'generateType'
)
||
''
,
})
.
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
const
{
data
}
=
res
;
props
.
updateConfig
&&
props
.
updateConfig
(
Object
.
assign
({},
window
.
globalConfig
,
{
access_token
:
data
.
access_token
,
token
:
data
.
user_token
,
}),
);
return
data
;
}
message
.
error
({
duration
:
3
,
content
:
`授权失败:
${
res
.
msg
}
`
,
});
action
&&
action
.
events
.
emit
(
'loginError'
,
res
.
msg
);
return
Promise
.
reject
(
res
);
})
.
then
(
res
=>
{
action
.
transformLoginHander
(
res
,
false
);
});
}
else
{
action
.
init
();
}
}
}
},
[
action
,
action
.
globalConfig
,
props
.
global
]);
},
[
action
,
action
.
globalConfig
,
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