mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-04-26 02:05:38 -05:00
Fix missing ban reason dropped during merge
This commit is contained in:
parent
df1c6a83fc
commit
ea56689f08
|
|
@ -98,7 +98,7 @@ func handleBanImpl(w http.ResponseWriter, r *http.Request) (*database.User, bool
|
||||||
ErrorCode: 22002,
|
ErrorCode: 22002,
|
||||||
MessageRMC: map[byte]string{
|
MessageRMC: map[byte]string{
|
||||||
gpcm.LangEnglish: "" +
|
gpcm.LangEnglish: "" +
|
||||||
"You have been banned from Retro WFC\n" +
|
"You have been banned from WiiLink WFC\n" +
|
||||||
"Reason: " + req.Reason + "\n" +
|
"Reason: " + req.Reason + "\n" +
|
||||||
"Error Code: %[1]d\n" +
|
"Error Code: %[1]d\n" +
|
||||||
"Support Info: NG%08[2]x",
|
"Support Info: NG%08[2]x",
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ func handleKickImpl(w http.ResponseWriter, r *http.Request) (*database.User, boo
|
||||||
MessageRMC: map[byte]string{
|
MessageRMC: map[byte]string{
|
||||||
gpcm.LangEnglish: "" +
|
gpcm.LangEnglish: "" +
|
||||||
"You have been kicked from\n" +
|
"You have been kicked from\n" +
|
||||||
"Retro WFC by a moderator.\n" +
|
"WiiLink WFC by a moderator.\n" +
|
||||||
"Reason: " + req.Reason + "\n" +
|
"Reason: " + req.Reason + "\n" +
|
||||||
"Error Code: %[1]d",
|
"Error Code: %[1]d",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const (
|
||||||
ON ng_device_id && array[dt.device_id]
|
ON ng_device_id && array[dt.device_id]
|
||||||
) SELECT array_agg(DISTINCT device_id) FROM device_tree
|
) SELECT array_agg(DISTINCT device_id) FROM device_tree
|
||||||
)
|
)
|
||||||
SELECT has_ban, ban_tos, ng_device_id
|
SELECT has_ban, ban_tos, ng_device_id, ban_reason
|
||||||
FROM users
|
FROM users
|
||||||
WHERE has_ban = true
|
WHERE has_ban = true
|
||||||
AND (profile_id = $2
|
AND (profile_id = $2
|
||||||
|
|
@ -170,8 +170,10 @@ func LoginUserToGPCM(pool *pgxpool.Pool, ctx context.Context, userId uint64, gsb
|
||||||
var banExists bool
|
var banExists bool
|
||||||
var banTOS bool
|
var banTOS bool
|
||||||
var bannedDeviceIdList []uint32
|
var bannedDeviceIdList []uint32
|
||||||
|
var banReason string
|
||||||
|
|
||||||
timeNow := time.Now()
|
timeNow := time.Now()
|
||||||
err = pool.QueryRow(ctx, SearchUserBan, user.NgDeviceId, user.ProfileId, ipAddress, *lastIPAddress, timeNow).Scan(&banExists, &banTOS, &bannedDeviceIdList)
|
err = pool.QueryRow(ctx, SearchUserBan, user.NgDeviceId, user.ProfileId, ipAddress, *lastIPAddress, timeNow).Scan(&banExists, &banTOS, &bannedDeviceIdList, &banReason)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != pgx.ErrNoRows {
|
if err != pgx.ErrNoRows {
|
||||||
|
|
@ -203,12 +205,13 @@ func LoginUserToGPCM(pool *pgxpool.Pool, ctx context.Context, userId uint64, gsb
|
||||||
|
|
||||||
if banTOS {
|
if banTOS {
|
||||||
logging.Warn("DATABASE", "Profile", aurora.Cyan(user.ProfileId), "is banned")
|
logging.Warn("DATABASE", "Profile", aurora.Cyan(user.ProfileId), "is banned")
|
||||||
return User{RestrictedDeviceId: bannedDeviceId}, ErrProfileBannedTOS
|
return User{RestrictedDeviceId: bannedDeviceId, BanReason: banReason}, ErrProfileBannedTOS
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.Warn("DATABASE", "Profile", aurora.Cyan(user.ProfileId), "is restricted")
|
logging.Warn("DATABASE", "Profile", aurora.Cyan(user.ProfileId), "is restricted")
|
||||||
user.Restricted = true
|
user.Restricted = true
|
||||||
user.RestrictedDeviceId = bannedDeviceId
|
user.RestrictedDeviceId = bannedDeviceId
|
||||||
|
user.BanReason = banReason
|
||||||
}
|
}
|
||||||
|
|
||||||
return user, nil
|
return user, nil
|
||||||
|
|
|
||||||
|
|
@ -480,7 +480,7 @@ func (g *GameSpySession) performLoginWithDatabase(userId uint64, gsbrCode string
|
||||||
ErrorCode: 22002,
|
ErrorCode: 22002,
|
||||||
MessageRMC: map[byte]string{
|
MessageRMC: map[byte]string{
|
||||||
LangEnglish: "" +
|
LangEnglish: "" +
|
||||||
"You are banned from Retro WFC\n" +
|
"You are banned from WiiLink WFC\n" +
|
||||||
"Reason: " + user.BanReason + "\n" +
|
"Reason: " + user.BanReason + "\n" +
|
||||||
"Error Code: %[1]d\n" +
|
"Error Code: %[1]d\n" +
|
||||||
"Support Info: NG%08[2]x",
|
"Support Info: NG%08[2]x",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user