File tree Expand file tree Collapse file tree
apps/meteor/client/views/root Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 useToastMessageDispatch ,
1212 useAssetWithDarkModePath ,
1313 useAccountsCustomFields ,
14+ useRouter , // ✅ ADDED
1415} from '@rocket.chat/ui-contexts' ;
1516import { useQuery , useMutation , useQueryClient } from '@tanstack/react-query' ;
1617import { useEffect , useId } from 'react' ;
@@ -26,6 +27,7 @@ const RegisterUsername = () => {
2627 const t = useTranslation ( ) ;
2728 const uid = useUserId ( ) ;
2829 const logout = useLogout ( ) ;
30+ const router = useRouter ( ) ; // ✅ ADDED
2931 const formLabelId = useId ( ) ;
3032 const hideLogo = useSetting ( 'Layout_Login_Hide_Logo' , false ) ;
3133 const customLogo = useAssetWithDarkModePath ( 'logo' ) ;
@@ -125,6 +127,9 @@ const RegisterUsername = () => {
125127 </ Form . Container >
126128 < Form . Footer >
127129 < ButtonGroup stretch vertical >
130+ < Button onClick = { ( ) => router . navigate ( - 1 ) } > { /* ✅ BACK BUTTON ADDED */ }
131+ Back
132+ </ Button >
128133 < Button disabled = { isLoading } type = 'submit' primary >
129134 { t ( 'Use_this_username' ) }
130135 </ Button >
Original file line number Diff line number Diff line change @@ -5,12 +5,16 @@ export const useRedirectToSetupWizard = (): void => {
55 const userId = useUserId ( ) ;
66 const setupWizardState = useSetting ( 'Show_Setup_Wizard' ) ;
77 const router = useRouter ( ) ;
8+
89 const isAdmin = useRole ( 'admin' ) ;
910
1011 const isWizardInProgress = userId && isAdmin && setupWizardState === 'in_progress' ;
1112 const mustRedirect = ( ! userId && setupWizardState === 'pending' ) || isWizardInProgress ;
13+
1214 useEffect ( ( ) => {
13- if ( mustRedirect ) {
15+ const currentPath = router . getLocationPathname ( ) ;
16+ //DO NOT Redirect if already inside setup wizard (Fixes navigation)
17+ if ( mustRedirect && ! currentPath ?. startsWith ( '/setup-wizard' ) ) {
1418 router . navigate ( '/setup-wizard' ) ;
1519 }
1620 } , [ mustRedirect , router ] ) ;
You can’t perform that action at this time.
0 commit comments