Adds custom and direct login types

This commit is contained in:
ericdecanini 2022-03-15 14:53:59 +01:00
parent 70b5b9855a
commit ae540297b1
4 changed files with 8 additions and 2 deletions

View file

@ -98,7 +98,7 @@ internal class DefaultLoginWizard(
authAPI.login(data) authAPI.login(data)
} }
return sessionCreator.createSession(credentials, pendingSessionData.homeServerConnectionConfig, LoginType.UNSUPPORTED) return sessionCreator.createSession(credentials, pendingSessionData.homeServerConnectionConfig, LoginType.CUSTOM)
} }
override suspend fun resetPassword(email: String, newPassword: String) { override suspend fun resetPassword(email: String, newPassword: String) {

View file

@ -77,7 +77,7 @@ internal class DefaultDirectLoginTask @Inject constructor(
} }
} }
return sessionCreator.createSession(credentials, params.homeServerConnectionConfig, LoginType.UNSUPPORTED) return sessionCreator.createSession(credentials, params.homeServerConnectionConfig, LoginType.DIRECT)
} }
private fun buildClient(homeServerConnectionConfig: HomeServerConnectionConfig): OkHttpClient { private fun buildClient(homeServerConnectionConfig: HomeServerConnectionConfig): OkHttpClient {

View file

@ -20,6 +20,8 @@ enum class LoginType(val value: String) {
PASSWORD("password"), PASSWORD("password"),
SSO("sso"), SSO("sso"),
UNSUPPORTED("unsupported"), UNSUPPORTED("unsupported"),
CUSTOM("custom"),
DIRECT("direct"),
UNKNOWN("unknown"); UNKNOWN("unknown");
companion object { companion object {
@ -28,6 +30,8 @@ enum class LoginType(val value: String) {
PASSWORD.value -> PASSWORD PASSWORD.value -> PASSWORD
SSO.value -> SSO SSO.value -> SSO
UNSUPPORTED.value -> UNSUPPORTED UNSUPPORTED.value -> UNSUPPORTED
CUSTOM.value -> CUSTOM
DIRECT.value -> DIRECT
else -> UNKNOWN else -> UNKNOWN
} }
} }

View file

@ -27,6 +27,8 @@ class LoginTypeTest {
LoginType.fromValue(LoginType.PASSWORD.value) shouldBeEqualTo LoginType.PASSWORD LoginType.fromValue(LoginType.PASSWORD.value) shouldBeEqualTo LoginType.PASSWORD
LoginType.fromValue(LoginType.SSO.value) shouldBeEqualTo LoginType.SSO LoginType.fromValue(LoginType.SSO.value) shouldBeEqualTo LoginType.SSO
LoginType.fromValue(LoginType.UNSUPPORTED.value) shouldBeEqualTo LoginType.UNSUPPORTED LoginType.fromValue(LoginType.UNSUPPORTED.value) shouldBeEqualTo LoginType.UNSUPPORTED
LoginType.fromValue(LoginType.CUSTOM.value) shouldBeEqualTo LoginType.CUSTOM
LoginType.fromValue(LoginType.DIRECT.value) shouldBeEqualTo LoginType.DIRECT
LoginType.fromValue(LoginType.UNKNOWN.value) shouldBeEqualTo LoginType.UNKNOWN LoginType.fromValue(LoginType.UNKNOWN.value) shouldBeEqualTo LoginType.UNKNOWN
} }