You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Verify that the updated login type string "linotp" is consistently integrated across the file. Ensure that all changes align with backend expectations and that no inconsistencies remain from the previous "linOtp" naming.
Confirm that the modifications in the login flow—especially the conditions for setting the login type and handling the OTP login—do not inadvertently affect other authentication paths. Ensure proper integration testing for scenarios involving multiple providers.
if(loginType==='linotp'){awaitconfigStore.loginOTP(data.USERNAME,data.PASSWORD).then(()=>{// noopsetShowOTPCodeField(true);}).catch((error)=>{setError(error.message);}).finally(()=>{// turn off loadingsetIsLoading(false);});}}if(showOTPCodeField){awaitconfigStore.confirmOTP(data.OTP_CONFIRM).then(()=>{// noop}).catch((error)=>{setError(error.message);}).finally(()=>{// turn off loadingsetIsLoading(false);});setShowOTPCodeField(true);}},);/** * Allow the user to login */constregisterAccount=registerSubmit(async(data: TypeUserRegister): Promise<TypeUserRegister>=>{// turn on loadingsetIsLoading(true);if(!data.USERNAME||!data.PASSWORD||!data.PASSWORD_CONFIRMATION||!data.FIRST_NAME||!data.LAST_NAME||!data.EMAIL){setError('Username, password, password confirmation, email, first and last name are required',);setIsLoading(false);return;}if(data.PASSWORD!==data.PASSWORD_CONFIRMATION){setError('Passwords do not match');setIsLoading(false);return;}awaitconfigStore.register(`${data.FIRST_NAME}${data.LAST_NAME}`,data.USERNAME,data.EMAIL,data.PASSWORD,data.PHONE,data.EXTENTION,data.COUNTRY_CODE,).then((res)=>{if(res){setError('');setRegister(false);setSuccess('Account registration successful. Log in below.',);}}).catch((error)=>{setIsLoading(false);setError(error.message);}).finally(()=>{// turn off loadingsetIsLoading(false);});},);/** * Login with oauth * @param provider - provider to oauth with */constoauth=async(provider: string)=>{// turn on loadingsetIsLoading(true);awaitconfigStore.oauth(provider).then(()=>{// turn off loadingsetIsLoading(false);// noop// (handled by the configStore)setSnackbar({open: true,message: `Successfully logged in`,color: 'success',});}).catch((error)=>{// turn off loadingsetIsLoading(false);setError(error.message);setSnackbar({open: true,message: error.message,color: 'error',});});};constthemeMap=useMemo(()=>{consttheme=configStore.store.config['theme'];if(theme&&theme['THEME_MAP']){try{returnJSON.parse(theme['THEME_MAP']asstring);}catch{return{};}}return{};},[Object.keys(configStore.store.config).length]);// get the path the user is coming fromconstpath=(location.stateas{from: Location})?.from?.pathname||'/';// navigate if already logged inif(configStore.store.status==='SUCCESS'){return<Navigateto={path}replace/>;}return(<><Snackbaropen={snackbar.open}anchorOrigin={{vertical: 'top',horizontal: 'right'}}autoHideDuration={6000}onClose={()=>{setSnackbar({open: false,message: '',color: 'success',});}}><Alertseverity={snackbar.color}sx={{width: '100%'}}>{snackbar.message}</Alert></Snackbar><StyledMain><StyledRow><StyledScroll><StyledContent><div><StyledLogoBox>{themeMap.isLogoUrl ? (<StyledLogosrc={themeMap.logo}/>) : THEME.logo ? (<StyledLogosrc={THEME.logo}/>) : null}<StyledLogoText>{themeMap.name
? themeMap.name
: THEME.name}</StyledLogoText></StyledLogoBox><Typographyvariant="h4">Welcome!</Typography><StyledInstructionsvariant="body1">{register
? 'Register below'
: 'Log in below'}</StyledInstructions></div>{!register&&hasMoreThanOneUserNamePassword&&(<StyledButtonGroupvariant="outlined">{isNative &&(<StyledButtonGroupItemonClick={()=>{setLoginType('native');setSuccess('');setError('');}}selected={loginType==='native'}>Native</StyledButtonGroupItem>)}{isLdap&&(<StyledButtonGroupItemonClick={()=>{setLoginType('ldap');setSuccess('');setError('');}}selected={loginType==='ldap'}>LDAP</StyledButtonGroupItem>)}{isLinOTP&&(<StyledButtonGroupItemonClick={()=>{setLoginType('linotp');setSuccess('');setError('');}}selected={loginType==='linotp'}>
Why: While extracting login type literals into an enum would improve consistency and reduce chances for case mismatch issues, it only offers a moderate stylistic enhancement rather than fixing a critical bug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.