Only submit captcha once in Registration V2.
This commit is contained in:
parent
fdf858f379
commit
e6a126d416
1 changed files with 5 additions and 3 deletions
|
@ -373,14 +373,16 @@ class RegistrationV2ViewModel : ViewModel() {
|
||||||
val e164 = getCurrentE164() ?: throw IllegalStateException("Can't submit captcha token if no phone number is set!")
|
val e164 = getCurrentE164() ?: throw IllegalStateException("Can't submit captcha token if no phone number is set!")
|
||||||
val captchaToken = store.value.captchaToken ?: throw IllegalStateException("Can't submit captcha token if no captcha token is set!")
|
val captchaToken = store.value.captchaToken ?: throw IllegalStateException("Can't submit captcha token if no captcha token is set!")
|
||||||
|
|
||||||
|
store.update {
|
||||||
|
it.copy(captchaToken = null)
|
||||||
|
}
|
||||||
|
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val session = getOrCreateValidSession(context, errorHandler) ?: return@launch bail { Log.i(TAG, "Could not create valid session for submitting a captcha token.") }
|
val session = getOrCreateValidSession(context, errorHandler) ?: return@launch bail { Log.i(TAG, "Could not create valid session for submitting a captcha token.") }
|
||||||
Log.d(TAG, "Submitting captcha token…")
|
Log.d(TAG, "Submitting captcha token…")
|
||||||
val captchaSubmissionResult = RegistrationRepository.submitCaptchaToken(context, e164, password, session.body.id, captchaToken)
|
val captchaSubmissionResult = RegistrationRepository.submitCaptchaToken(context, e164, password, session.body.id, captchaToken)
|
||||||
Log.d(TAG, "Captcha token submitted.")
|
Log.d(TAG, "Captcha token submitted.")
|
||||||
store.update {
|
|
||||||
it.copy(captchaToken = null)
|
|
||||||
}
|
|
||||||
handleSessionStateResult(context, captchaSubmissionResult, errorHandler)
|
handleSessionStateResult(context, captchaSubmissionResult, errorHandler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue