@@ -359,19 +359,38 @@ const queryCategoryStatus = () => {
359359const callBackType = () => {
360360 return getQueryString (' state' )
361361}
362+ const loginTypeParam = (): number | null => {
363+ let login_type = getQueryString (' login_type' )
364+ if (! login_type ) {
365+ return null
366+ }
367+ const mappingArray = [' default' , ' cas' , ' oidc' , ' ldap' , ' oauth2' , ' saml2' ]
368+ const index = mappingArray .indexOf (login_type .toLocaleLowerCase ())
369+ if (index === - 1 ) {
370+ if (/ ^ [0-5 ] $ / .test (login_type )) {
371+ return parseInt (login_type )
372+ }
373+ return null
374+ }
375+ return index
376+ }
362377
363378const auto2Platform = async () => {
364379 if (adminLogin .value ) {
365380 updateLoading (false , 100 )
366381 return
367382 }
368- const resData = await request .get (' /system/parameter/login' )
369- let res = 0
370- const resObj = {} as any
371- resData .forEach ((item : any ) => {
372- resObj [item .pkey ] = item .pval
373- })
374- res = parseInt (resObj [' login.default_login' ] || 0 )
383+ let res: number | null = loginTypeParam ()
384+ if (res === null ) {
385+ const resData = await request .get (' /system/parameter/login' )
386+
387+ const resObj = {} as any
388+ resData .forEach ((item : any ) => {
389+ resObj [item .pkey ] = item .pval
390+ })
391+ res = parseInt (resObj [' login.default_login' ] || 0 )
392+ }
393+
375394 const originArray = [' default' , ' cas' , ' oidc' , ' ldap' , ' oauth2' , ' saml2' ]
376395 if (res && ! adminLogin .value && loginCategory .value [originArray [res ] as keyof LoginCategory ]) {
377396 if (res === 3 ) {
0 commit comments