@@ -85,7 +85,12 @@ const StepBackButton = (props : {
85
85
Back
86
86
</ Button >
87
87
)
88
- export default function FormLoginSteps ( ) {
88
+
89
+ type FormLoginProps = {
90
+ organizationId ?: string ;
91
+ }
92
+
93
+ export default function FormLoginSteps ( props : FormLoginProps ) {
89
94
const dispatch = useDispatch ( ) ;
90
95
const location = useLocation ( ) ;
91
96
const [ account , setAccount ] = useState ( ( ) => {
@@ -100,7 +105,8 @@ export default function FormLoginSteps() {
100
105
const [ orgLoading , setOrgLoading ] = useState ( false ) ;
101
106
const [ orgList , setOrgList ] = useState < OrgItem [ ] > ( [ ] ) ;
102
107
const [ currentStep , setCurrentStep ] = useState < CurrentStepEnum > ( CurrentStepEnum . EMAIL ) ;
103
- const [ organizationId , setOrganizationId ] = useState < string > ( ) ;
108
+ const [ organizationId , setOrganizationId ] = useState < string | undefined > ( props . organizationId ) ;
109
+ const [ skipWorkspaceStep , setSkipWorkspaceStep ] = useState < boolean > ( false ) ;
104
110
105
111
const { onSubmit, loading } = useAuthSubmit (
106
112
( ) =>
@@ -119,6 +125,15 @@ export default function FormLoginSteps() {
119
125
) ;
120
126
121
127
const fetchOrgsByEmail = ( ) => {
128
+ // if user is invited or using org's login url then avoid fetching workspaces
129
+ // and skip workspace selection step
130
+ if ( organizationId ) {
131
+ setSkipWorkspaceStep ( true ) ;
132
+ dispatch ( fetchConfigAction ( organizationId ) ) ;
133
+ setCurrentStep ( CurrentStepEnum . AUTH_PROVIDERS ) ;
134
+ return ;
135
+ }
136
+
122
137
setOrgLoading ( true ) ;
123
138
OrgApi . fetchOrgsByEmail ( account )
124
139
. then ( ( resp ) => {
@@ -209,7 +224,10 @@ export default function FormLoginSteps() {
209
224
return (
210
225
< >
211
226
< AccountLoginWrapper >
212
- < StepBackButton onClick = { ( ) => setCurrentStep ( CurrentStepEnum . WORKSPACES ) } />
227
+ < StepBackButton onClick = { ( ) => {
228
+ if ( skipWorkspaceStep ) return setCurrentStep ( CurrentStepEnum . EMAIL ) ;
229
+ setCurrentStep ( CurrentStepEnum . WORKSPACES )
230
+ } } />
213
231
< StepHeader title = { trans ( "userAuth.enterPassword" ) } />
214
232
< PasswordInput
215
233
className = "form-input password-input"
0 commit comments