This commit is contained in:
Benoit Marty 2019-11-21 16:04:21 +01:00
parent edb65f1787
commit 1a603742d0
4 changed files with 8 additions and 17 deletions

View File

@ -30,12 +30,5 @@ data class InteractiveAuthenticationFlow(
@Json(name = "stages")
val stages: List<String>? = null
) {
)
companion object {
// Possible values for type
const val TYPE_LOGIN_SSO = "m.login.sso"
const val TYPE_LOGIN_TOKEN = "m.login.token"
const val TYPE_LOGIN_PASSWORD = "m.login.password"
}
}

View File

@ -16,7 +16,6 @@
package im.vector.matrix.android.internal.auth.data
// TODO Move to [InteractiveAuthenticationFlow]
object LoginFlowTypes {
const val PASSWORD = "m.login.password"
const val OAUTH2 = "m.login.oauth2"
@ -27,4 +26,6 @@ object LoginFlowTypes {
const val RECAPTCHA = "m.login.recaptcha"
const val DUMMY = "m.login.dummy"
const val TERMS = "m.login.terms"
const val TOKEN = "m.login.token"
const val SSO = "m.login.sso"
}

View File

@ -30,7 +30,6 @@ import im.vector.riotx.core.extensions.showPassword
import io.reactivex.Observable
import io.reactivex.functions.BiFunction
import io.reactivex.rxkotlin.subscribeBy
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_login.passwordField
import kotlinx.android.synthetic.main.fragment_login.passwordFieldTil
import kotlinx.android.synthetic.main.fragment_login.passwordReveal
@ -133,9 +132,7 @@ class LoginResetPasswordFragment @Inject constructor(
renderPasswordField()
}
is Fail -> {
// TODO This does not work, we want the error to be on without text. Fix that
resetPasswordEmailTil.error = ""
// TODO Handle error text properly
resetPasswordEmailTil.error = " "
passwordFieldTil.error = errorFormatter.toHumanReadable(state.asyncResetPassword.error)
}
is Success -> {

View File

@ -30,8 +30,8 @@ import im.vector.matrix.android.api.auth.registration.RegistrationWizard
import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.util.Cancelable
import im.vector.matrix.android.api.util.MatrixCallbackDelegate
import im.vector.matrix.android.internal.auth.data.InteractiveAuthenticationFlow
import im.vector.matrix.android.internal.auth.data.LoginFlowResponse
import im.vector.matrix.android.internal.auth.data.LoginFlowTypes
import im.vector.riotx.core.di.ActiveSessionHolder
import im.vector.riotx.core.extensions.configureAndStart
import im.vector.riotx.core.platform.VectorViewModel
@ -461,9 +461,9 @@ class LoginViewModel @AssistedInject constructor(@Assisted initialState: LoginVi
override fun onSuccess(data: LoginFlowResponse) {
val loginMode = when {
// SSO login is taken first
data.flows.any { it.type == InteractiveAuthenticationFlow.TYPE_LOGIN_SSO } -> LoginMode.Sso
data.flows.any { it.type == InteractiveAuthenticationFlow.TYPE_LOGIN_PASSWORD } -> LoginMode.Password
else -> LoginMode.Unsupported(data.flows.mapNotNull { it.type }.toList())
data.flows.any { it.type == LoginFlowTypes.SSO } -> LoginMode.Sso
data.flows.any { it.type == LoginFlowTypes.PASSWORD } -> LoginMode.Password
else -> LoginMode.Unsupported(data.flows.mapNotNull { it.type }.toList())
}
setState {