Compare commits
1 commit
a9479d9106
...
6986ab5a1c
Author | SHA1 | Date | |
---|---|---|---|
6986ab5a1c |
1 changed files with 3 additions and 3 deletions
|
@ -7,9 +7,9 @@ data class ActivationCode(
|
|||
val confirmationCodeRequired: Boolean = false,
|
||||
) {
|
||||
companion object {
|
||||
fun fromString(token: String): ActivationCode {
|
||||
val input = if (token.startsWith("LPA:", true)) token.drop(4) else token
|
||||
val components = input.split('$').map { it.trim().ifEmpty { null } }
|
||||
fun fromString(input: String): ActivationCode {
|
||||
check(input.startsWith("LPA:", ignoreCase = true)) { "Invalid activation code format" }
|
||||
val components = input.drop(4).split('$').map { it.trim().ifEmpty { null } }
|
||||
check(components.size >= 2) { "Invalid activation code format" }
|
||||
check(components[0] == "1") { "Invalid activation code version" }
|
||||
return ActivationCode(
|
||||
|
|
Loading…
Add table
Reference in a new issue