Skip to content

Commit

Permalink
Hotfixes for invalid ID length and undefined validation
Browse files Browse the repository at this point in the history
  • Loading branch information
orchestr7 committed Sep 8, 2024
1 parent 93c9158 commit 6e09919
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TelegramAuthService(
@Value("\${telegram.bot.token}") private val telegramToken: String,
) {
fun isValidHash(parsedData: Map<String, String>, hash: String): Boolean {
val dataKeys = parsedData.keys.filter { it != "hash" }.sorted()
val dataKeys = parsedData.keys.filter { it != "hash" }.filter { parsedData[it] != "undefined" }.sorted()
val items = dataKeys.map { key -> "$key=${parsedData[key]}" }
val dataCheckString = items.joinToString("\n")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ val questionCard = FC<QuestionCard> { props ->

when {
response.ok -> props.setUser(response.decodeFromJsonString<UserForSerializationDTO>())
else -> window.alert("Failed to login with telegram")
else -> window.alert("Failed to validate with telegram")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ val resultCard = FC<ResultProps> { props ->

when {
response.ok -> props.setUser(response.decodeFromJsonString<UserForSerializationDTO>())
else -> window.alert("Failed to login with telegram")
else -> window.alert("Failed to validate with telegram")
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/jsMain/kotlin/ru/posidata/views/main/Welcome.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
response.ok -> {
props.setUser(response.decodeFromJsonString<UserForSerializationDTO>())
}
else -> window.alert("Failed to login with telegram")
else -> window.alert("Failed to validate with telegram")
}
}
props.setSelection(Selection.QUESTION)
}

// just a small test
/*
div {
button {
onClick = {
Expand All @@ -71,6 +72,7 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
}
}
}
*/


div {
Expand Down

0 comments on commit 6e09919

Please sign in to comment.