mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-12-14 11:56:15 +08:00
[-] Replace login blocking with an @ AquaDX prefix
This commit is contained in:
@@ -99,9 +99,6 @@
|
|||||||
state = 'verify'
|
state = 'verify'
|
||||||
verifyMsg = t("welcome.verify-state-2")
|
verifyMsg = t("welcome.verify-state-2")
|
||||||
}
|
}
|
||||||
else if (e.message === 'Login not allowed: Card has been migrated to Minato.') {
|
|
||||||
location.href = `https://portal.mumur.net/login?username=${encodeURIComponent(email)}`
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
error = e.message
|
error = e.message
|
||||||
submitting = false // unnecessary? see line 113, same for both reset functions
|
submitting = false // unnecessary? see line 113, same for both reset functions
|
||||||
|
|||||||
@@ -93,8 +93,6 @@ class UserRegistrar(
|
|||||||
?: (400 - "User not found")
|
?: (400 - "User not found")
|
||||||
if (!hasher.matches(password, user.pwHash)) 400 - "Invalid password"
|
if (!hasher.matches(password, user.pwHash)) 400 - "Invalid password"
|
||||||
|
|
||||||
if (user.ghostCard.status == CardStatus.MIGRATED_TO_MINATO) 400 - "Login not allowed: Card has been migrated to Minato."
|
|
||||||
|
|
||||||
// Check if email is verified
|
// Check if email is verified
|
||||||
if (!user.emailConfirmed && emailProps.enable) {
|
if (!user.emailConfirmed && emailProps.enable) {
|
||||||
// Check if last confirmation email was sent within a minute
|
// Check if last confirmation email was sent within a minute
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import icu.samnyan.aqua.net.BotProps
|
|||||||
import icu.samnyan.aqua.net.db.AquaUserServices
|
import icu.samnyan.aqua.net.db.AquaUserServices
|
||||||
import icu.samnyan.aqua.net.utils.SUCCESS
|
import icu.samnyan.aqua.net.utils.SUCCESS
|
||||||
import icu.samnyan.aqua.sega.general.model.Card
|
import icu.samnyan.aqua.sega.general.model.Card
|
||||||
import icu.samnyan.aqua.sega.general.model.CardStatus
|
|
||||||
import jakarta.annotation.PostConstruct
|
import jakarta.annotation.PostConstruct
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
@@ -56,7 +55,7 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
|||||||
|
|
||||||
val reqUser = token?.let { us.jwt.auth(it) }?.let { u ->
|
val reqUser = token?.let { us.jwt.auth(it) }?.let { u ->
|
||||||
// Optimization: If the user is not banned, we don't need to process user information
|
// Optimization: If the user is not banned, we don't need to process user information
|
||||||
if (!u.ghostCard.rankingBanned && !u.cards.any { it.rankingBanned } && u.ghostCard.status == CardStatus.NORMAL) null
|
if (!u.ghostCard.rankingBanned && !u.cards.any { it.rankingBanned } && u.ghostCard.status.isNormal) null
|
||||||
else u
|
else u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -236,9 +236,7 @@ fun ChusanController.chusanInit() {
|
|||||||
) + userDict
|
) + userDict
|
||||||
|
|
||||||
if (user.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
if (user.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
res["userName"] = "JiaQQqun / ChangeDNS"
|
res["userName"] = "${res["userName"]}@AquaDX"
|
||||||
res["rating"] = 0
|
|
||||||
res["playerLevel"] = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
@@ -394,13 +392,6 @@ fun ChusanController.chusanInit() {
|
|||||||
// }
|
// }
|
||||||
// process()
|
// process()
|
||||||
|
|
||||||
val user = db.userData.findByCard_ExtId(uid)()
|
|
||||||
|
|
||||||
if (user?.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
|
||||||
"""{"returnCode":"0"}"""
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
"""{"returnCode":"1"}"""
|
"""{"returnCode":"1"}"""
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import ext.*
|
|||||||
import icu.samnyan.aqua.sega.chusan.ChusanController
|
import icu.samnyan.aqua.sega.chusan.ChusanController
|
||||||
import icu.samnyan.aqua.sega.chusan.model.request.Chu3UserAll
|
import icu.samnyan.aqua.sega.chusan.model.request.Chu3UserAll
|
||||||
import icu.samnyan.aqua.sega.chusan.model.userdata.*
|
import icu.samnyan.aqua.sega.chusan.model.userdata.*
|
||||||
|
import icu.samnyan.aqua.sega.general.model.CardStatus
|
||||||
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating
|
import icu.samnyan.aqua.sega.general.model.response.UserRecentRating
|
||||||
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
@@ -36,6 +37,12 @@ fun ChusanController.upsertApiInit() {
|
|||||||
userNameEx = ""
|
userNameEx = ""
|
||||||
}.also { db.userData.saveAndFlush(it) }
|
}.also { db.userData.saveAndFlush(it) }
|
||||||
|
|
||||||
|
// If the user was previously migrated to Minato, saving would mark them "migrated and then cleared".
|
||||||
|
if (u.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
|
u.card?.status = CardStatus.NORMAL_MIGRATED_TO_MINATO_AND_THEN_CLEARED
|
||||||
|
us.cardRepo.save(u.card!!)
|
||||||
|
}
|
||||||
|
|
||||||
// Only save if it is a valid region and the user has played at least a song
|
// Only save if it is a valid region and the user has played at least a song
|
||||||
req.userPlaylogList?.firstOrNull()?.regionId?.let { rid ->
|
req.userPlaylogList?.firstOrNull()?.regionId?.let { rid ->
|
||||||
val region = db.userRegions.findByUserAndRegionId(u, rid)?.apply {
|
val region = db.userRegions.findByUserAndRegionId(u, rid)?.apply {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ enum class CardStatus {
|
|||||||
NORMAL,
|
NORMAL,
|
||||||
|
|
||||||
// Reserved for future use
|
// Reserved for future use
|
||||||
NORMAL_RESERVED_1,
|
NORMAL_MIGRATED_TO_MINATO_AND_THEN_CLEARED,
|
||||||
NORMAL_RESERVED_2,
|
NORMAL_RESERVED_2,
|
||||||
NORMAL_RESERVED_3,
|
NORMAL_RESERVED_3,
|
||||||
NORMAL_RESERVED_4,
|
NORMAL_RESERVED_4,
|
||||||
@@ -22,7 +22,12 @@ enum class CardStatus {
|
|||||||
// Deleted statuses
|
// Deleted statuses
|
||||||
OVERWRITTEN,
|
OVERWRITTEN,
|
||||||
DELETED,
|
DELETED,
|
||||||
MIGRATED_TO_MINATO,
|
MIGRATED_TO_MINATO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if card status is in any NORMAL state
|
||||||
|
*/
|
||||||
|
val isNormal get() = this.ordinal in NORMAL.ordinal..NORMAL_RESERVED_9.ordinal
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -115,10 +115,7 @@ fun Maimai2ServletController.initApis() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (d.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
if (d.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
res["userName"] = "JiaQQqun / ChangeDNS"
|
res["userName"] = "${res["userName"]}@AquaDX"
|
||||||
res["dispRate"] = 1
|
|
||||||
res["playerRating"] = 66564
|
|
||||||
res["totalAwake"] = 7114
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
@@ -134,10 +131,6 @@ fun Maimai2ServletController.initApis() {
|
|||||||
"Bearer" to "meow", "bearer" to "meow"
|
"Bearer" to "meow", "bearer" to "meow"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (d?.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
|
||||||
res["returnCode"] = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get regionId from request
|
// Get regionId from request
|
||||||
val region = data["regionId"] as? Int
|
val region = data["regionId"] as? Int
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,14 @@ import ext.invoke
|
|||||||
import ext.mapApply
|
import ext.mapApply
|
||||||
import ext.unique
|
import ext.unique
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||||
|
import icu.samnyan.aqua.sega.general.model.CardStatus
|
||||||
import icu.samnyan.aqua.sega.general.service.CardService
|
import icu.samnyan.aqua.sega.general.service.CardService
|
||||||
import icu.samnyan.aqua.sega.maimai2.handler.UploadUserPlaylogHandler.Companion.playBacklog
|
import icu.samnyan.aqua.sega.maimai2.handler.UploadUserPlaylogHandler.Companion.playBacklog
|
||||||
import icu.samnyan.aqua.sega.maimai2.model.*
|
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||||
import icu.samnyan.aqua.sega.maimai2.model.request.Mai2UpsertUserAll
|
import icu.samnyan.aqua.sega.maimai2.model.request.Mai2UpsertUserAll
|
||||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.*
|
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail
|
||||||
|
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserGeneralData
|
||||||
|
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserRate
|
||||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||||
import lombok.AllArgsConstructor
|
import lombok.AllArgsConstructor
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
@@ -59,6 +62,12 @@ class UpsertUserAllHandler(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// If the user was previously migrated to Minato, saving would mark them "migrated and then cleared".
|
||||||
|
if (u.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
|
u.card?.status = CardStatus.NORMAL_MIGRATED_TO_MINATO_AND_THEN_CLEARED
|
||||||
|
cardService.cardRepo.save(u.card!!)
|
||||||
|
}
|
||||||
|
|
||||||
// Check playlog backlog
|
// Check playlog backlog
|
||||||
if (playBacklog.containsKey(userId)) playBacklog.remove(userId)?.forEach {
|
if (playBacklog.containsKey(userId)) playBacklog.remove(userId)?.forEach {
|
||||||
repos.userPlaylog.save(it.playlog.apply { user = u })
|
repos.userPlaylog.save(it.playlog.apply { user = u })
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ext.int
|
|||||||
import ext.invoke
|
import ext.invoke
|
||||||
import ext.mapApply
|
import ext.mapApply
|
||||||
import ext.minus
|
import ext.minus
|
||||||
|
import icu.samnyan.aqua.sega.general.model.CardStatus
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.OngekiUpsertUserAll
|
import icu.samnyan.aqua.sega.ongeki.model.OngekiUpsertUserAll
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.UserData
|
import icu.samnyan.aqua.sega.ongeki.model.UserData
|
||||||
import icu.samnyan.aqua.sega.ongeki.model.UserGeneralData
|
import icu.samnyan.aqua.sega.ongeki.model.UserGeneralData
|
||||||
@@ -49,6 +50,12 @@ fun OngekiController.initUpsertAll() {
|
|||||||
db.regions.save(region)
|
db.regions.save(region)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the user was previously migrated to Minato, saving would mark them "migrated and then cleared".
|
||||||
|
if (u.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
|
u.card?.status = CardStatus.NORMAL_MIGRATED_TO_MINATO_AND_THEN_CLEARED
|
||||||
|
us.cardRepo.save(u.card!!)
|
||||||
|
}
|
||||||
|
|
||||||
all.run {
|
all.run {
|
||||||
// Set users
|
// Set users
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
|
|||||||
@@ -162,26 +162,13 @@ fun OngekiController.initUser() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (u.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
if (u.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
res["userName"] = "JiaQQqun / ChangeDNS"
|
res["userName"] = "${res["userName"]}@AquaDX"
|
||||||
res["level"] = 0
|
|
||||||
res["exp"] = 0
|
|
||||||
res["playerRating"] = 0
|
|
||||||
res["newPlayerRating"] = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
"GameLogin" {
|
"GameLogin" { """{"returnCode":"1"}""" }
|
||||||
val user = db.data.findByCard_ExtId(uid)()
|
|
||||||
|
|
||||||
if (user?.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
|
||||||
"""{"returnCode":"0"}"""
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
"""{"returnCode":"1"}"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"GetUserRecentRating".unpaged {
|
"GetUserRecentRating".unpaged {
|
||||||
db.generalData.findByUser_Card_ExtIdAndPropertyKey(uid, "recent_rating_list")()?.let { recent ->
|
db.generalData.findByUser_Card_ExtIdAndPropertyKey(uid, "recent_rating_list")()?.let { recent ->
|
||||||
|
|||||||
@@ -224,9 +224,9 @@ fun WaccaServer.init() {
|
|||||||
|
|
||||||
val status = u.lStatus().toMutableList()
|
val status = u.lStatus().toMutableList()
|
||||||
|
|
||||||
if (u.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
// if (u.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
status[1] = "JiaQQqun / ChangeDNS"
|
// status[1] = "${status[1]}@AquaDX"
|
||||||
}
|
// }
|
||||||
|
|
||||||
u.run { ls(
|
u.run { ls(
|
||||||
"0 status" - status,
|
"0 status" - status,
|
||||||
|
|||||||
Reference in New Issue
Block a user