Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 48867ff

Browse files
committed
remove auth and others but it work like edit
1 parent 1d9bf81 commit 48867ff

40 files changed

+26
-2553
lines changed

viewer/packages/lowcoder/src/api/apiUtils.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
ERROR_500,
88
SERVER_API_TIMEOUT_ERROR,
99
} from "constants/messages";
10-
import { AUTH_BIND_URL, OAUTH_REDIRECT } from "constants/routesURL";
1110
import log from "loglevel";
1211
import history from "util/history";
1312
import axios, { AxiosError, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from "axios";
@@ -63,11 +62,6 @@ const notAuthRequiredPath = (requestUrl: string | undefined) => {
6362
);
6463
};
6564

66-
const notNeedBindPath = () => {
67-
const pathName = window.location.pathname;
68-
return pathName === AUTH_BIND_URL || pathName === OAUTH_REDIRECT;
69-
};
70-
7165
export const apiRequestInterceptor = (config: InternalAxiosRequestConfig): AxiosRequestConfigWithTimer => ({
7266
...config,
7367
timer: performance.now(),
@@ -137,14 +131,6 @@ export const apiFailureResponseInterceptor = (error: any) => {
137131
});
138132
}
139133
}
140-
if (error.response?.data?.code === SERVER_ERROR_CODES.NEED_BIND && !notNeedBindPath()) {
141-
history.push(AUTH_BIND_URL);
142-
return Promise.reject({
143-
code: ERROR_CODES.SERVER_ERROR,
144-
message: trans("apiMessage.verifyAccount"),
145-
show: false,
146-
});
147-
}
148134
if (
149135
error.response?.data?.code === SERVER_ERROR_CODES.CURRENT_EDITION_NOT_SUPPORT_THIS_FEATURE
150136
) {

viewer/packages/lowcoder/src/api/configApi.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

viewer/packages/lowcoder/src/app.tsx

Lines changed: 9 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ import {
1010
DATASOURCE_URL,
1111
IMPORT_APP_FROM_TEMPLATE_URL,
1212
INVITE_LANDING_URL,
13-
isAuthUnRequired,
14-
ORG_AUTH_LOGIN_URL,
15-
ORG_AUTH_REGISTER_URL,
1613
QUERY_LIBRARY_URL,
17-
USER_AUTH_URL,
1814
ADMIN_APP_URL,
1915
} from "constants/routesURL";
2016
import React from "react";
@@ -30,22 +26,17 @@ import { developEnv } from "util/envUtils";
3026
import history from "util/history";
3127
import LazyRoute from "components/LazyRoute";
3228
import { getAntdLocale } from "i18n/antdLocale";
33-
import { ProductLoading } from "components/ProductLoading";
3429
import { trans } from "i18n"; // language
3530
import { loadComps } from "comps";
3631
import { initApp } from "util/commonUtils";
3732
import { favicon } from "assets/images";
3833
import { hasQueryParam } from "util/urlUtils";
3934
import { isFetchUserFinished } from "redux/selectors/usersSelectors"; // getCurrentUser,
4035
import { getIsCommonSettingFetched } from "redux/selectors/commonSettingSelectors";
41-
import { SystemWarning } from "./components/SystemWarning";
42-
import { getBrandingConfig } from "./redux/selectors/configSelectors";
43-
import { buildMaterialPreviewURL } from "./util/materialUtils";
4436
import GlobalInstances from 'components/GlobalInstances';
4537
// import posthog from 'posthog-js'
4638
import { fetchHomeData } from "./redux/reduxActions/applicationActions";
4739

48-
const LazyUserAuthComp = React.lazy(() => import("pages/userAuth"));
4940
const LazyInviteLanding = React.lazy(() => import("pages/common/inviteLanding"));
5041
const LazyComponentDoc = React.lazy(() => import("pages/ComponentDoc"));
5142
const LazyComponentPlayground = React.lazy(() => import("pages/ComponentPlayground"));
@@ -66,20 +57,12 @@ const Wrapper = (props: { children: React.ReactNode, language: string }) => (
6657
);
6758

6859
type AppIndexProps = {
69-
isFetchUserFinished: boolean;
70-
getIsCommonSettingFetched: boolean;
7160
currentOrgId?: string;
7261
currentUserId: string;
7362
currentUserAnonymous: boolean;
7463
orgDev: boolean;
7564
defaultHomePage: string | null | undefined;
76-
fetchHomeDataFinished: boolean;
77-
fetchConfig: (orgId?: string) => void;
78-
fetchHomeData: (currentUserAnonymous?: boolean | undefined) => void;
7965
getCurrentUser: () => void;
80-
favicon: string;
81-
brandName: string;
82-
uiLanguage: string;
8366
};
8467

8568
class AppIndex extends React.Component<AppIndexProps, any> {
@@ -91,15 +74,6 @@ class AppIndex extends React.Component<AppIndexProps, any> {
9174
}
9275

9376
componentDidUpdate(prevProps: AppIndexProps) {
94-
if (
95-
prevProps.currentOrgId !== this.props.currentOrgId &&
96-
this.props.currentOrgId !== ''
97-
) {
98-
this.props.fetchConfig(this.props.currentOrgId);
99-
if (!this.props.currentUserAnonymous) {
100-
this.props.fetchHomeData(this.props.currentUserAnonymous);
101-
}
102-
}
10377
}
10478
render() {
10579
const isTemplate = hasQueryParam('template');
@@ -113,29 +87,14 @@ class AppIndex extends React.Component<AppIndexProps, any> {
11387
posthog.init('phc_lD36OXeppUehLgI33YFhioTpXqThZ5QqR8IWeKvXP7f', { api_host: 'https://eu.i.posthog.com', person_profiles: 'always' });
11488
} */
11589

116-
// make sure all users in this app have checked login info
117-
if (!this.props.isFetchUserFinished || (this.props.currentUserId && !this.props.fetchHomeDataFinished)) {
118-
const hideLoadingHeader = isTemplate || isAuthUnRequired(pathname);
119-
return <ProductLoading hideHeader={hideLoadingHeader} />;
120-
}
121-
else {
122-
// if the user just logged in, we send the event to posthog
123-
if (isLocalhost || isLowCoderDomain) {
124-
if (sessionStorage.getItem('_just_logged_in_')) {
125-
// posthog.identify(this.props.currentUserId);
126-
sessionStorage.removeItem('_just_logged_in_');
127-
}
128-
}
129-
}
130-
13190
// persisting the language in local storage
132-
localStorage.setItem('lowcoder_uiLanguage', this.props.uiLanguage);
91+
localStorage.setItem('lowcoder_uiLanguage', "en_US");
13392

13493
return (
135-
<Wrapper language={this.props.uiLanguage}>
94+
<Wrapper language="en_US">
13695
<Helmet>
137-
{<title>{this.props.brandName}</title>}
138-
{<link rel="icon" href={this.props.favicon} />}
96+
{<title>Lowcoder</title>}
97+
{<link rel="icon" href="" />}
13998
<meta name="description" content={trans('productDesc')} />
14099
<meta
141100
name="keywords"
@@ -147,7 +106,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
147106
<meta
148107
key="og:title"
149108
property="og:title"
150-
content={this.props.brandName}
109+
content="Lowcoder"
151110
/>
152111
<meta
153112
key="og:description"
@@ -170,7 +129,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
170129
<meta
171130
key="twitter:title"
172131
name="twitter:title"
173-
content={this.props.brandName}
132+
content="Lowcoder"
174133
/>
175134
<meta
176135
key="twitter:description"
@@ -208,7 +167,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
208167
<meta
209168
key="apple-mobile-web-app-title"
210169
name="apple-mobile-web-app-title"
211-
content={this.props.brandName}
170+
content="Lowcoder"
212171
/>
213172
<link
214173
key="apple-touch-icon"
@@ -224,7 +183,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
224183
<meta
225184
key="application-name"
226185
name="application-name"
227-
content={this.props.brandName}
186+
content="Lowcoder"
228187
/>
229188
<meta
230189
key="msapplication-TileColor"
@@ -244,7 +203,7 @@ class AppIndex extends React.Component<AppIndexProps, any> {
244203
<meta
245204
key="iframely:title"
246205
property="iframely:title"
247-
content={this.props.brandName}
206+
content="Lowcoder"
248207
/>,
249208
<meta
250209
key="iframely:description"
@@ -284,23 +243,13 @@ class AppIndex extends React.Component<AppIndexProps, any> {
284243
></script>,
285244
]}
286245
</Helmet>
287-
<SystemWarning />
288246
<Router history={history}>
289247
<Switch>
290248
<LazyRoute
291249
fallback="layout"
292250
path={APP_EDITOR_URL}
293251
component={LazyAppEditor}
294252
/>
295-
<LazyRoute path={USER_AUTH_URL} component={LazyUserAuthComp} />
296-
<LazyRoute
297-
path={ORG_AUTH_LOGIN_URL}
298-
component={LazyUserAuthComp}
299-
/>
300-
<LazyRoute
301-
path={ORG_AUTH_REGISTER_URL}
302-
component={LazyUserAuthComp}
303-
/>
304253
<LazyRoute
305254
path={INVITE_LANDING_URL}
306255
component={LazyInviteLanding}
@@ -332,30 +281,19 @@ class AppIndex extends React.Component<AppIndexProps, any> {
332281
}
333282

334283
const mapStateToProps = (state: AppState) => ({
335-
isFetchUserFinished: isFetchUserFinished(state),
336-
getIsCommonSettingFetched: getIsCommonSettingFetched(state),
337284
orgDev: state.ui.users.user.orgDev,
338285
currentUserId: state.ui.users.currentUser.id,
339286
currentUserAnonymous: state.ui.users.currentUser.name === "ANONYMOUS",
340287
currentOrgId: state.ui.users.user.currentOrgId,
341288
defaultHomePage: state.ui.application.homeOrg?.commonSettings.defaultHomePage,
342289
fetchHomeDataFinished: Boolean(state.ui.application.homeOrg?.commonSettings),
343-
favicon: getBrandingConfig(state)?.favicon
344-
? buildMaterialPreviewURL(getBrandingConfig(state)?.favicon!)
345-
: favicon,
346-
brandName: getBrandingConfig(state)?.brandName ?? trans("productName"),
347290
uiLanguage: state.ui.users.user.uiLanguage,
348291
});
349292

350293
const mapDispatchToProps = (dispatch: any) => ({
351294
getCurrentUser: () => {
352295
dispatch(fetchUserAction());
353296
},
354-
fetchConfig: (orgId?: string) => dispatch(fetchConfigAction(orgId)),
355-
356-
fetchHomeData: (currentUserAnonymous: boolean | undefined) => {
357-
dispatch(fetchHomeData({}));
358-
}
359297
});
360298

361299
const AppIndexWithProps = connect(mapStateToProps, mapDispatchToProps)(AppIndex);

viewer/packages/lowcoder/src/appView/AppViewInstance.tsx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import type { Root } from "react-dom/client";
88
import { StyleSheetManager } from "styled-components";
99
import type { ModuleDSL, ModuleDSLIoInput } from "types/dsl";
1010
import { API_STATUS_CODES } from "constants/apiConstants";
11-
import { AUTH_LOGIN_URL } from "constants/routesURL";
12-
import { AuthSearchParams } from "constants/authConstants";
13-
import { saveAuthSearchParams } from "pages/userAuth/authUtils";
1411
import { Suspense, lazy } from "react";
1512
import Flex from "antd/es/flex";
1613
import { TacoButton } from "components/button";
@@ -88,10 +85,6 @@ export class AppViewInstance<I = any, O = any> {
8885
.then((i) => i.data)
8986
.catch((e) => {
9087
if (e.response?.status === API_STATUS_CODES.REQUEST_NOT_AUTHORISED) {
91-
saveAuthSearchParams({
92-
[AuthSearchParams.redirectUrl]: encodeURIComponent(window.location.href),
93-
[AuthSearchParams.loginType]: null,
94-
})
9588

9689
this.authorizedUser = false;
9790
return {
@@ -167,9 +160,6 @@ export class AppViewInstance<I = any, O = any> {
167160

168161
private async render() {
169162
const data = await this.dataPromise;
170-
const loginUrl = this.options.orgId
171-
? `${this.options.webUrl}/org/${this.options.orgId}/auth/login`
172-
: `${this.options.webUrl}${AUTH_LOGIN_URL}`;
173163

174164
this.root.render(
175165
this.authorizedUser ? (
@@ -191,11 +181,6 @@ export class AppViewInstance<I = any, O = any> {
191181
{!isAuthButtonClicked ? (
192182
<TacoButton
193183
buttonType="primary"
194-
onClick={() => {
195-
isAuthButtonClicked = true;
196-
window.open(loginUrl, '_blank');
197-
this.render();
198-
}}
199184
>
200185
Login
201186
</TacoButton>

viewer/packages/lowcoder/src/components/PageSkeleton.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Header from "./layout/Header";
66
import { Logo, LogoWithName, LogoHome } from "@lowcoder-ee/assets/images";
77
import styled from "styled-components";
88
import { useSelector } from "react-redux";
9-
import { getBrandingConfig, getSystemConfigFetching } from "../redux/selectors/configSelectors";
109
import { isFetchUserFinished } from "../redux/selectors/usersSelectors";
1110
import { CSSProperties } from "react";
1211

@@ -58,11 +57,8 @@ const SkeletonWrapper = styled.div`
5857
`;
5958

6059
export default function PageSkeleton(props: IProps) {
61-
const isConfigFetching = useSelector(getSystemConfigFetching);
6260
const fetchUserFinished = useSelector(isFetchUserFinished);
63-
const brandingConfig = useSelector(getBrandingConfig);
6461

65-
const isHeaderReady = !isConfigFetching && fetchUserFinished;
6662

6763
const {
6864
logoWithName = false,

viewer/packages/lowcoder/src/components/SystemWarning.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)