[F] Fix username check

pull/99/head^2
Azalea 2025-01-05 05:21:47 -05:00
parent 7ad4bc2ba5
commit 51af357c5a
3 changed files with 4 additions and 4 deletions

View File

@ -310,4 +310,6 @@ export const SETTING = {
post('/api/v2/settings/get', {}),
set: (key: string, value: any) =>
post('/api/v2/settings/set', { key, value: `${value}` }),
detailSet: (game: string, field: string, value: any) =>
post(`/api/v2/game/${game}/user-detail-set`, { field, value }),
}

View File

@ -21,7 +21,7 @@ fun usernameCheck(chars: String): (IUserData, String) -> Unit = { u, v ->
u.userName = v
if (v.isBlank()) { 400 - "Username cannot be blank" }
if (v.length > 8) { 400 - "Username too long" }
v.find { it !in chars }?.let { 400 - "Invalid character '$it' in username" }
// v.find { it !in chars }?.let { 400 - "Invalid character '$it' in username" }
}
fun toFullWidth(input: String): String {

View File

@ -26,9 +26,7 @@ class Maimai2(
// Only show > S rank
override val shownRanks = mai2Scores.filter { it.first >= 97 * 10000 }
override val settableFields: Map<String, (Mai2UserDetail, String) -> Unit> by lazy {
mapOf(
"userName" to usernameCheck(SEGA_USERNAME_CAHRS),
)
mapOf("userName" to usernameCheck(SEGA_USERNAME_CAHRS))
}
override suspend fun userSummary(@RP username: Str, @RP token: String?) = us.cardByName(username) { card ->