diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/components/setUsername.tsx b/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/components/setUsername.tsx deleted file mode 100644 index 9e052924c88..00000000000 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/components/setUsername.tsx +++ /dev/null @@ -1,70 +0,0 @@ -/** @file Container responsible for rendering and interactions in setting username flow, after - * registration. */ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -import * as React from "react"; - -import * as auth from "../providers/auth"; -import withRouter from "../../navigation"; -import * as hooks from "../../hooks"; -import * as utils from "../../utils"; -import * as Icons from "../../components/svg"; - - - -// ============================ -// === setUsernameContainer === -// ============================ - -const setUsernameContainer = () => { - const { setUsername } = auth.useAuth(); - const { accessToken, email } = auth.usePartialUserSession(); - - const { value: username, bind: bindUsername } = hooks.useInput(""); - - return ( -
-
-
- Set your username -
-
-
- setUsername(accessToken, username, email) - )} - > -
-
-
- -
- - -
-
-
- -
-
-
-
-
- ); -}; - -export default withRouter(setUsernameContainer); diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/providers/auth.tsx b/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/providers/auth.tsx index 476e6c9131c..32f0358dc6f 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/providers/auth.tsx +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/authentication/providers/auth.tsx @@ -23,7 +23,6 @@ import * as error from "../../error"; const MESSAGES = { signUpSuccess: "We have sent you an email with further instructions!", confirmSignUpSuccess: "Your account has been confirmed! Please log in.", - setUsernameSuccess: "Your username has been set!", signInWithPasswordSuccess: "Successfully logged in!", pleaseWait: "Please wait...", }; @@ -83,11 +82,6 @@ export interface PartialUserSession { interface AuthContextType { signUp: (email: string, password: string) => Promise; confirmSignUp: (email: string, code: string) => Promise; - setUsername: ( - accessToken: string, - username: string, - email: string - ) => Promise; signInWithGoogle: () => Promise; signInWithGitHub: () => Promise; signInWithPassword: (email: string, password: string) => Promise; @@ -238,25 +232,6 @@ export const AuthProvider = (props: AuthProviderProps) => { navigate(app.LOGIN_PATH); }); - const setUsername = async ( - accessToken: string, - username: string, - email: string - ) => { - const body: backendService.SetUsernameRequestBody = { - userName: username, - userEmail: email, - }; - - // TODO [NP]: https://github.com/enso-org/cloud-v2/issues/343 - // Don't create a new API client here, reuse the one from the context. - const backend = backendService.createBackend(accessToken, logger); - - await backend.setUsername(body); - navigate(app.DASHBOARD_PATH); - toast.success(MESSAGES.setUsernameSuccess); - }; - const signInWithPassword = async (email: string, password: string) => cognito.signInWithPassword(email, password).then((result) => { if (result.ok) { @@ -274,7 +249,6 @@ export const AuthProvider = (props: AuthProviderProps) => { const value = { signUp: withLoadingToast(signUp), confirmSignUp: withLoadingToast(confirmSignUp), - setUsername, signInWithGoogle: cognito.signInWithGoogle, signInWithGitHub: cognito.signInWithGitHub, signInWithPassword: withLoadingToast(signInWithPassword), @@ -342,10 +316,6 @@ export const ProtectedLayout = () => { export const GuestLayout = () => { const { session } = useAuth(); - if (session?.state == "partial") { - return ; - } - if (session?.state == "full") { return ; } @@ -355,16 +325,6 @@ export const GuestLayout = () => { -// ============================= -// === usePartialUserSession === -// ============================= - -export const usePartialUserSession = () => { - return router.useOutletContext(); -}; - - - // ========================== // === useFullUserSession === // ========================== diff --git a/app/ide-desktop/lib/dashboard/src/authentication/src/components/app.tsx b/app/ide-desktop/lib/dashboard/src/authentication/src/components/app.tsx index 344e26d6155..a16af0268ff 100644 --- a/app/ide-desktop/lib/dashboard/src/authentication/src/components/app.tsx +++ b/app/ide-desktop/lib/dashboard/src/authentication/src/components/app.tsx @@ -9,7 +9,6 @@ import DashboardContainer from "../dashboard/components/dashboard"; import LoginContainer from "../authentication/components/login"; import RegistrationContainer from "../authentication/components/registration"; import ConfirmRegistrationContainer from "../authentication/components/confirmRegistration"; -import SetUsernameContainer from "../authentication/components/setUsername"; import * as authService from "../authentication/service"; import withRouter from "../navigation"; import * as loggerProvider from "../providers/logger"; @@ -29,8 +28,6 @@ export const LOGIN_PATH = "/login"; export const REGISTRATION_PATH = "/registration"; /** Path to the confirm registration page. */ export const CONFIRM_REGISTRATION_PATH = "/confirmation"; -/** Path to the set username page. */ -export const SET_USERNAME_PATH = "/set-username"; @@ -124,10 +121,6 @@ const AppRouter = (props: AppProps) => { } /> - } - /> {/* Other pages are visible to unauthenticated and authenticated users. */} => - this.post(SET_USER_NAME_PATH) - .json(body) - .send() - .then((response) => response.model()); - /** Returns organization info for the current user, from the Cloud backend API. * * @returns `null` if status code 401 or 404 was received. */