Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit79c07b0

Browse files
on logout, user should redirect to workspace login page when login/register using workspace url
1 parenta43628b commit79c07b0

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

‎client/packages/lowcoder/src/api/apiUtils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ export const apiFailureResponseInterceptor = (error: any) => {
122122
if(!notAuthRequiredPath(error.config?.url)){
123123
if(error.response.status===API_STATUS_CODES.REQUEST_NOT_AUTHORISED){
124124
// get x-org-id from failed request
125-
constorganizationId=error.response.headers['x-org-id']||undefined;
125+
letorganizationId;
126+
if(error.response.headers['x-org-id']){
127+
organizationId=error.response.headers['x-org-id'];
128+
}
129+
if(localStorage.getItem('lowcoder_login_orgId')){
130+
organizationId=localStorage.getItem('lowcoder_login_orgId');
131+
localStorage.removeItem('lowcoder_login_orgId');
132+
}
126133
// Redirect to login and set a redirect url.
127134
StoreRegistry.getStore().dispatch(
128135
logoutAction({

‎client/packages/lowcoder/src/pages/common/profileDropdown.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,13 @@ export default function ProfileDropdown(props: DropDownProps) {
150150
dispatch(profileSettingModalVisible(true));
151151
}elseif(e.key==="logout"){
152152
// logout
153-
dispatch(logoutAction({}));
153+
constorganizationId=localStorage.getItem('lowcoder_login_orgId');
154+
if(organizationId){
155+
localStorage.removeItem('lowcoder_login_orgId');
156+
}
157+
dispatch(logoutAction({
158+
organizationId:organizationId||undefined,
159+
}));
154160
}elseif(e.keyPath.includes("switchOrg")){
155161
if(e.key==="newOrganization"){
156162
// create new organization

‎client/packages/lowcoder/src/pages/userAuth/formLoginSteps.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ export default function FormLoginSteps(props: FormLoginProps) {
155155
setSigninEnabled(LOWCODER_EMAIL_AUTH_ENABLED==='true');
156156
},[serverSettings]);
157157

158+
constafterLoginSuccess=()=>{
159+
if(props.organizationId){
160+
localStorage.setItem("lowcoder_login_orgId",props.organizationId);
161+
}
162+
fetchUserAfterAuthSuccess?.();
163+
}
164+
158165
const{ onSubmit, loading}=useAuthSubmit(
159166
()=>
160167
UserApi.formLogin({
@@ -168,7 +175,7 @@ export default function FormLoginSteps(props: FormLoginProps) {
168175
}),
169176
false,
170177
redirectUrl,
171-
fetchUserAfterAuthSuccess,
178+
afterLoginSuccess,
172179
);
173180

174181
constfetchOrgsByEmail=()=>{
@@ -274,7 +281,7 @@ export default function FormLoginSteps(props: FormLoginProps) {
274281
<Divider/>
275282
<AuthBottomView>
276283
<StyledRouteLinkto={{
277-
pathname:AUTH_REGISTER_URL,
284+
pathname:props.organizationId ?`/org/${props.organizationId}/auth/register` :AUTH_REGISTER_URL,
278285
state:{...location.state||{},email:account}
279286
}}>
280287
{trans("userAuth.register")}

‎client/packages/lowcoder/src/pages/userAuth/register.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ function UserRegister() {
8686
};
8787
},[serverSettings]);
8888

89+
constafterLoginSuccess=()=>{
90+
if(organizationId){
91+
localStorage.setItem("lowcoder_login_orgId",organizationId);
92+
}
93+
fetchUserAfterAuthSuccess?.();
94+
}
95+
8996
const{ loading, onSubmit}=useAuthSubmit(
9097
()=>
9198
UserApi.formLogin({
@@ -99,7 +106,7 @@ function UserRegister() {
99106
}),
100107
false,
101108
redirectUrl,
102-
fetchUserAfterAuthSuccess,
109+
afterLoginSuccess,
103110
);
104111

105112
constcheckEmailExist=()=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp