Fix sign in to registers using full login with prefix

This commit is contained in:
Mikołaj Pich 2023-01-05 21:15:40 +01:00
parent 6b8049af23
commit d19d74d254
3 changed files with 13 additions and 8 deletions

View file

@ -7,7 +7,7 @@ plugins {
}
ext {
PUBLISH_VERSION = '1.9.0'
PUBLISH_VERSION = '1.9.1-SNAPSHOT'
SITE_URL = 'https://github.com/wulkanowy/sdk'
GIT_URL = 'https://github.com/wulkanowy/sdk.git'

View file

@ -69,19 +69,16 @@ class LoginHelper(
ADFS -> {
when (host) {
"umt.tarnow.pl" -> {
val login = if ("@" in email) email else "EDUNET\\$email"
sendADFSMS(login, password)
sendADFSMS(getNormalizedADFSLogin(email, "EDUNET"), password)
}
"edu.gdansk.pl" -> {
sendADFSLightGeneric(email, password, ADFSLightCufs)
}
"eduportal.koszalin.pl" -> {
val login = if ("@" in email) email else "EDUPORTAL\\$email"
sendADFSMS(login, password)
sendADFSMS(getNormalizedADFSLogin(email, "EDUPORTAL"), password)
}
"eszkola.opolskie.pl" -> {
val login = if ("@" in email) email else "EDUPORTAL\\$email"
sendADFSMS(login, password)
sendADFSMS(getNormalizedADFSLogin(email, "EDUPORTAL"), password)
}
else -> sendADFSMS(it, password)
}
@ -206,6 +203,14 @@ class LoginHelper(
)
}
private fun getNormalizedADFSLogin(login: String, prefix: String): String {
return when {
"@" in login -> login
"\\" in login -> login
else -> "$prefix\\$login"
}
}
private fun getADFSUrl(type: Scrapper.LoginType): String {
val id = when (type) {
ADFS -> if (host == "eduportal.koszalin.pl") "ADFS" else "adfs"

View file

@ -13,7 +13,7 @@ class HostsRemoteTest : BaseTest() {
"vulcan.net.pl" to "Default",
"eszkola.opolskie.pl" to "opole",
"edu.gdansk.pl" to "gdansk",
"edu.lublin.eu" to "lublin",
// "edu.lublin.eu" to "lublin", // they are blocking us :///
"umt.tarnow.pl" to "tarnow",
"eduportal.koszalin.pl" to "koszalin",
"vulcan.net.pl" to "rawamazowiecka",