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 { ext {
PUBLISH_VERSION = '1.9.0' PUBLISH_VERSION = '1.9.1-SNAPSHOT'
SITE_URL = 'https://github.com/wulkanowy/sdk' SITE_URL = 'https://github.com/wulkanowy/sdk'
GIT_URL = 'https://github.com/wulkanowy/sdk.git' GIT_URL = 'https://github.com/wulkanowy/sdk.git'

View file

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

View file

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