?: User(
discordId = credentials.name,
discordName = "",
- discordDiscriminator = "0000",
+ discordDiscriminator = "",
discordAvatar = null,
- profileName = "Test User"
+ profileName = credentials.name
).also {
User.put(it)
}
call.respondHtml(HttpStatusCode.OK, page("Authentication Test", call.standardNavBar(), CustomSidebar {
p {
- +"This instance does not have Discrd OAuth login set up. As a fallback, this authentication mode is used for testing."
+ +"This instance does not have Discord OAuth login set up. As a fallback, this authentication mode is used for testing."
}
}) {
section {
val discordAvatarUrl: String
get() = discordAvatar?.let {
"https://cdn.discordapp.com/avatars/$discordId/$it." + (if (it.startsWith("a_")) "gif" else "png") + "?size=256"
- } ?: "https://cdn.discordapp.com/embed/avatars/${discordDiscriminator.last().digitToInt() % 5}.png"
+ } ?: "https://cdn.discordapp.com/embed/avatars/${(discordDiscriminator.lastOrNull()?.digitToInt() ?: 0) % 5}.png"
companion object Table : DocumentTable<User> by DocumentTable.create({
unique(User::discordId)