mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-03-21 17:44:58 -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,
|
||||
MessageRMC: map[byte]string{
|
||||
gpcm.LangEnglish: "" +
|
||||
"You have been banned from Retro WFC\n" +
|
||||
"You have been banned from WiiLink WFC\n" +
|
||||
"Reason: " + req.Reason + "\n" +
|
||||
"Error Code: %[1]d\n" +
|
||||
"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{
|
||||
gpcm.LangEnglish: "" +
|
||||
"You have been kicked from\n" +
|
||||
"Retro WFC by a moderator.\n" +
|
||||
"WiiLink WFC by a moderator.\n" +
|
||||
"Reason: " + req.Reason + "\n" +
|
||||
"Error Code: %[1]d",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const (
|
|||
ON ng_device_id && array[dt.device_id]
|
||||
) 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
|
||||
WHERE has_ban = true
|
||||
AND (profile_id = $2
|
||||
|
|
@ -170,8 +170,10 @@ func LoginUserToGPCM(pool *pgxpool.Pool, ctx context.Context, userId uint64, gsb
|
|||
var banExists bool
|
||||
var banTOS bool
|
||||
var bannedDeviceIdList []uint32
|
||||
var banReason string
|
||||
|
||||
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 != pgx.ErrNoRows {
|
||||
|
|
@ -203,12 +205,13 @@ func LoginUserToGPCM(pool *pgxpool.Pool, ctx context.Context, userId uint64, gsb
|
|||
|
||||
if banTOS {
|
||||
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")
|
||||
user.Restricted = true
|
||||
user.RestrictedDeviceId = bannedDeviceId
|
||||
user.BanReason = banReason
|
||||
}
|
||||
|
||||
return user, nil
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ func (g *GameSpySession) performLoginWithDatabase(userId uint64, gsbrCode string
|
|||
ErrorCode: 22002,
|
||||
MessageRMC: map[byte]string{
|
||||
LangEnglish: "" +
|
||||
"You are banned from Retro WFC\n" +
|
||||
"You are banned from WiiLink WFC\n" +
|
||||
"Reason: " + user.BanReason + "\n" +
|
||||
"Error Code: %[1]d\n" +
|
||||
"Support Info: NG%08[2]x",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user