Update account unlock error validation
This commit is contained in:
parent
c9005720c9
commit
3c5a4d66ce
2 changed files with 6 additions and 4 deletions
|
@ -8,11 +8,11 @@ import io.github.wulkanowy.sdk.scrapper.Scrapper.LoginType.ADFSLightCufs
|
|||
import io.github.wulkanowy.sdk.scrapper.Scrapper.LoginType.ADFSLightScoped
|
||||
import io.github.wulkanowy.sdk.scrapper.Scrapper.LoginType.AUTO
|
||||
import io.github.wulkanowy.sdk.scrapper.Scrapper.LoginType.STANDARD
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.ScrapperException
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.InvalidCaptchaException
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.InvalidEmailException
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.NoAccountFoundException
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.PasswordResetErrorException
|
||||
import io.github.wulkanowy.sdk.scrapper.exception.ScrapperException
|
||||
import io.github.wulkanowy.sdk.scrapper.login.UrlGenerator
|
||||
import io.github.wulkanowy.sdk.scrapper.service.AccountService
|
||||
import java.net.URL
|
||||
|
@ -63,9 +63,11 @@ class AccountRepository(private val account: AccountService) {
|
|||
if (it.contains("żądanie nie zostało poprawnie autoryzowane")) throw InvalidCaptchaException(it)
|
||||
}
|
||||
}
|
||||
if (!res.message.startsWith("Wysłano wiadomość")) throw PasswordResetErrorException("Unexpected message: ${res.message}")
|
||||
if (res.message.isNotBlank() && !res.message.startsWith("Wysłano wiadomość")) {
|
||||
throw PasswordResetErrorException("Unexpected message: ${res.message}")
|
||||
}
|
||||
|
||||
return res.message
|
||||
return res.message.ifBlank { "Wysłano wiadomość na zapisany w systemie adres e-mail" }
|
||||
}
|
||||
|
||||
private suspend fun getPasswordResetUrl(registerBaseUrl: String, symbol: String): Pair<Scrapper.LoginType, String> {
|
||||
|
|
|
@ -83,7 +83,7 @@ abstract class BaseLocalTest : BaseTest() {
|
|||
autoLoginInterceptor: AutoLoginInterceptor = getAutoLoginInterceptor(loginType, autoLogin)
|
||||
): OkHttpClient = OkHttpClient.Builder()
|
||||
.apply {
|
||||
if (errorInterceptor) addInterceptor(ErrorInterceptor(cookies))
|
||||
if (errorInterceptor) addInterceptor(ErrorInterceptor(CookieManager()))
|
||||
if (autoLoginInterceptorOn) addInterceptor(autoLoginInterceptor)
|
||||
}
|
||||
.addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BASIC))
|
||||
|
|
Loading…
Reference in a new issue