mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 23:01:29 +03:00
Remove access without account (#9987)
Closes: https://github.com/enso-org/cloud-v2/issues/1229 This PR removes button "Continue without creating an account" on Login page. Aslo, This PR removes weird behaivor when dashboard goes into offline mode in canse if network error is happening
This commit is contained in:
parent
55d43a3d8a
commit
8e403fb0f2
@ -58,7 +58,6 @@ import SessionProvider from '#/providers/SessionProvider'
|
||||
import SupportsLocalBackendProvider from '#/providers/SupportsLocalBackendProvider'
|
||||
|
||||
import ConfirmRegistration from '#/pages/authentication/ConfirmRegistration'
|
||||
import EnterOfflineMode from '#/pages/authentication/EnterOfflineMode'
|
||||
import ErrorScreen from '#/pages/authentication/ErrorScreen'
|
||||
import ForgotPassword from '#/pages/authentication/ForgotPassword'
|
||||
import LoadingScreen from '#/pages/authentication/LoadingScreen'
|
||||
@ -390,10 +389,7 @@ function AppRouter(props: AppRouterProps) {
|
||||
{/* Login & registration pages are visible to unauthenticated users. */}
|
||||
<router.Route element={<authProvider.GuestLayout />}>
|
||||
<router.Route path={appUtils.REGISTRATION_PATH} element={<Registration />} />
|
||||
<router.Route
|
||||
path={appUtils.LOGIN_PATH}
|
||||
element={<Login supportsLocalBackend={supportsLocalBackend} />}
|
||||
/>
|
||||
<router.Route path={appUtils.LOGIN_PATH} element={<Login />} />
|
||||
</router.Route>
|
||||
|
||||
{/* Protected pages are visible to authenticated users. */}
|
||||
@ -441,7 +437,6 @@ function AppRouter(props: AppRouterProps) {
|
||||
<router.Route path={appUtils.CONFIRM_REGISTRATION_PATH} element={<ConfirmRegistration />} />
|
||||
<router.Route path={appUtils.FORGOT_PASSWORD_PATH} element={<ForgotPassword />} />
|
||||
<router.Route path={appUtils.RESET_PASSWORD_PATH} element={<ResetPassword />} />
|
||||
<router.Route path={appUtils.ENTER_OFFLINE_MODE_PATH} element={<EnterOfflineMode />} />
|
||||
|
||||
{/* Soft-deleted user pages are visible to users who have been soft-deleted. */}
|
||||
<router.Route element={<authProvider.ProtectedLayout />}>
|
||||
|
@ -28,7 +28,6 @@ export const RESET_PASSWORD_PATH = '/password-reset'
|
||||
/** Path to the set username page. */
|
||||
export const SET_USERNAME_PATH = '/set-username'
|
||||
/** Path to the offline mode entrypoint. */
|
||||
export const ENTER_OFFLINE_MODE_PATH = '/offline'
|
||||
/** Path to page in which the currently active payment plan can be managed. */
|
||||
export const SUBSCRIBE_PATH = '/subscribe'
|
||||
export const SUBSCRIBE_SUCCESS_PATH = '/subscribe/success'
|
||||
@ -36,7 +35,7 @@ export const SUBSCRIBE_SUCCESS_PATH = '/subscribe/success'
|
||||
export const ALL_PATHS_REGEX = new RegExp(
|
||||
`(?:${DASHBOARD_PATH}|${LOGIN_PATH}|${REGISTRATION_PATH}|${CONFIRM_REGISTRATION_PATH}|` +
|
||||
`${FORGOT_PASSWORD_PATH}|${RESET_PASSWORD_PATH}|${SET_USERNAME_PATH}|${RESTORE_USER_PATH}|` +
|
||||
`${ENTER_OFFLINE_MODE_PATH}|${SUBSCRIBE_PATH}|${SUBSCRIBE_SUCCESS_PATH})$`
|
||||
`${SUBSCRIBE_PATH}|${SUBSCRIBE_SUCCESS_PATH})$`
|
||||
)
|
||||
|
||||
// ===========
|
||||
|
@ -1,32 +0,0 @@
|
||||
/** @file Page to enter offlin mode and redirect to dashboard. */
|
||||
import * as React from 'react'
|
||||
|
||||
import * as appUtils from '#/appUtils'
|
||||
|
||||
import * as navigateHooks from '#/hooks/navigateHooks'
|
||||
|
||||
import * as authProvider from '#/providers/AuthProvider'
|
||||
|
||||
// ========================
|
||||
// === EnterOfflineMode ===
|
||||
// ========================
|
||||
|
||||
/** An empty component redirecting users based on the backend response to user registration. */
|
||||
export default function EnterOfflineMode() {
|
||||
const { goOffline } = authProvider.useAuth()
|
||||
const navigate = navigateHooks.useNavigate()
|
||||
|
||||
React.useEffect(() => {
|
||||
void (async () => {
|
||||
await goOffline(false)
|
||||
window.setTimeout(() => {
|
||||
navigate(appUtils.DASHBOARD_PATH)
|
||||
}, 0)
|
||||
})()
|
||||
// This MUST only run once. This is fine because the above function *always* `navigate`s
|
||||
// away.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [])
|
||||
|
||||
return <></>
|
||||
}
|
@ -29,14 +29,8 @@ import * as eventModule from '#/utilities/event'
|
||||
// === Login ===
|
||||
// =============
|
||||
|
||||
/** Props for a {@link Login}. */
|
||||
export interface LoginProps {
|
||||
readonly supportsLocalBackend: boolean
|
||||
}
|
||||
|
||||
/** A form for users to log in. */
|
||||
export default function Login(props: LoginProps) {
|
||||
const { supportsLocalBackend } = props
|
||||
export default function Login() {
|
||||
const location = router.useLocation()
|
||||
const { signInWithGoogle, signInWithGitHub, signInWithPassword } = authProvider.useAuth()
|
||||
const { getText } = textProvider.useText()
|
||||
@ -61,13 +55,6 @@ export default function Login(props: LoginProps) {
|
||||
icon={CreateAccountIcon}
|
||||
text={getText('dontHaveAnAccount')}
|
||||
/>
|
||||
{supportsLocalBackend && (
|
||||
<Link
|
||||
to={appUtils.ENTER_OFFLINE_MODE_PATH}
|
||||
icon={ArrowRightIcon}
|
||||
text={getText('continueWithoutCreatingAnAccount')}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
>
|
||||
|
@ -33,7 +33,7 @@ import type * as projectManager from '#/services/ProjectManager'
|
||||
import RemoteBackend from '#/services/RemoteBackend'
|
||||
|
||||
import * as errorModule from '#/utilities/error'
|
||||
import HttpClient, * as httpClient from '#/utilities/HttpClient'
|
||||
import HttpClient from '#/utilities/HttpClient'
|
||||
import * as object from '#/utilities/object'
|
||||
|
||||
import * as cognitoModule from '#/authentication/cognito'
|
||||
@ -280,16 +280,6 @@ export default function AuthProvider(props: AuthProviderProps) {
|
||||
[onSessionError, /* should never change */ goOffline]
|
||||
)
|
||||
|
||||
React.useEffect(() => {
|
||||
const onFetchError = () => {
|
||||
void goOffline()
|
||||
}
|
||||
document.addEventListener(httpClient.FETCH_ERROR_EVENT_NAME, onFetchError)
|
||||
return () => {
|
||||
document.removeEventListener(httpClient.FETCH_ERROR_EVENT_NAME, onFetchError)
|
||||
}
|
||||
}, [/* should never change */ goOffline])
|
||||
|
||||
/** Fetch the JWT access token from the session via the AWS Amplify library.
|
||||
*
|
||||
* When invoked, retrieves the access token (if available) from the storage method chosen when
|
||||
|
@ -373,7 +373,6 @@
|
||||
"signUpOrLoginWithGitHub": "Sign up or login with GitHub",
|
||||
"orLoginWithEmail": "or login with email",
|
||||
"dontHaveAnAccount": "Don't have an account?",
|
||||
"continueWithoutCreatingAnAccount": "Continue without creating an account",
|
||||
|
||||
"createANewAccount": "Create a new account",
|
||||
"confirmPasswordLabel": "Confirm password",
|
||||
|
Loading…
Reference in New Issue
Block a user