diff --git a/apps/skolplattformen-app/components/login.component.tsx b/apps/skolplattformen-app/components/login.component.tsx index 793d5592e..025afdbbc 100644 --- a/apps/skolplattformen-app/components/login.component.tsx +++ b/apps/skolplattformen-app/components/login.component.tsx @@ -47,25 +47,11 @@ const BankId = () => ( const FrejaEid = () => ( ) - - -interface Logins { - BANKID_SAME_DEVICE: number - BANKID_ANOTHER_DEVICE: number - TEST_USER: number -} - -const LoginMethods: Logins = { - BANKID_SAME_DEVICE: 0, - BANKID_ANOTHER_DEVICE: 2, - TEST_USER: 3, -} - export const Login = () => { const { api } = useApi() const [cancelLoginRequest, setCancelLoginRequest] = useState< @@ -84,6 +70,7 @@ export const Login = () => { const loginBankIdSameDeviceWithoutId = useFeature( 'LOGIN_BANK_ID_SAME_DEVICE_WITHOUT_ID' ) + const loginWithFrejaEnabled = useFeature('LOGIN_FREJA_EID') const { currentSchoolPlatform, changeSchoolPlatform } = useContext( SchoolPlatformContext ) @@ -95,10 +82,14 @@ export const Login = () => { const loginMethods = [ { id: 'thisdevice', title: t('auth.bankid.OpenOnThisDevice') }, { id: 'otherdevice', title: t('auth.bankid.OpenOnAnotherDevice') }, - { id: 'testuser', title: t('auth.loginAsTestUser') }, { id: 'freja', title: t('auth.freja.OpenOnThisDevice') }, + { id: 'testuser', title: t('auth.loginAsTestUser') }, ] as const + if (loginMethodId === 'freja' && !loginWithFrejaEnabled) { + setLoginMethodId('thisdevice') + } + const loginHandler = async () => { const user = await api.getUser() await AppStorage.clearPersonalData(user) @@ -112,10 +103,10 @@ export const Login = () => { } }, [api]) - const LoginProviderImage = () => { + const LoginProviderImage = () => { //if(loginMethodId == 'testuser') return undefined - if(loginMethodId == 'freja') return FrejaEid() - return BankId() + if (loginMethodId == 'freja') return FrejaEid() + return BankId() } const getSchoolPlatformName = () => { @@ -292,7 +283,11 @@ export const Login = () => { {t('auth.chooseLoginMethod')} f.id != 'freja') + } ItemSeparatorComponent={Divider} renderItem={({ item, index }) => (