mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Bans now give the banned player a message when trying to login
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
//Blocks an attempt to connect before even creating our client datum thing.
|
||||
world/IsBanned(key,address,computer_id)
|
||||
if(ckey(key) in admin_datums)
|
||||
return ..()
|
||||
|
||||
//Guest Checking
|
||||
if(!guests_allowed && IsGuestKey(key))
|
||||
log_access("Failed Login: [key] - Guests not allowed")
|
||||
@@ -19,7 +15,6 @@ world/IsBanned(key,address,computer_id)
|
||||
|
||||
|
||||
if(config.ban_legacy_system)
|
||||
|
||||
//Ban Checking
|
||||
. = CheckBan( ckey(key), computer_id, address )
|
||||
if(.)
|
||||
@@ -37,93 +32,6 @@ world/IsBanned(key,address,computer_id)
|
||||
world.log << "Ban database connection failure. Key [ckeytext] not checked"
|
||||
diary << "Ban database connection failure. Key [ckeytext] not checked"
|
||||
return
|
||||
|
||||
var/failedcid = 1
|
||||
var/failedip = 1
|
||||
|
||||
var/ipquery = ""
|
||||
var/cidquery = ""
|
||||
if(address)
|
||||
failedip = 0
|
||||
ipquery = " OR ip = '[address]' "
|
||||
|
||||
if(computer_id)
|
||||
failedcid = 0
|
||||
cidquery = " OR computerid = '[computer_id]' "
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM erro_Ban WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)")
|
||||
|
||||
query.Execute()
|
||||
|
||||
while(query.NextRow())
|
||||
var/pckey = query.item[1]
|
||||
//var/pip = query.item[2]
|
||||
//var/pcid = query.item[3]
|
||||
var/ackey = query.item[4]
|
||||
var/reason = query.item[5]
|
||||
var/expiration = query.item[6]
|
||||
var/duration = query.item[7]
|
||||
var/bantime = query.item[8]
|
||||
var/bantype = query.item[9]
|
||||
|
||||
var/expires = ""
|
||||
if(text2num(duration) > 0)
|
||||
expires = " The ban is for [duration] minutes and expires on [expiration] (server time)."
|
||||
|
||||
var/desc = "\nReason: You, or another user of this computer or connection ([pckey]) is banned from playing here. The ban reason is:\n[reason]\nThis ban was applied by [ackey] on [bantime], [expires]"
|
||||
|
||||
return list("reason"="[bantype]", "desc"="[desc]")
|
||||
|
||||
if (failedcid)
|
||||
message_admins("[key] has logged in with a blank computer id in the ban check.")
|
||||
if (failedip)
|
||||
message_admins("[key] has logged in with a blank ip in the ban check.")
|
||||
return ..() //default pager ban stuff
|
||||
|
||||
|
||||
/client/New()
|
||||
world.log << "Checking [src.key] for bans..."
|
||||
if(IsBanned())
|
||||
world.log << "[IsBanned()]"
|
||||
src << IsBanned()
|
||||
del src
|
||||
. = ..()
|
||||
|
||||
/client/proc/IsBanned()
|
||||
//Guest Checking
|
||||
if(!guests_allowed && IsGuestKey(src.key))
|
||||
log_access("Failed Login: [src.key] - Guests not allowed")
|
||||
message_admins("\blue Failed Login: [src.key] - Guests not allowed")
|
||||
return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.")
|
||||
|
||||
//check if the IP address is a known TOR node
|
||||
if(config && config.ToRban && ToRban_isbanned(src.address))
|
||||
log_access("Failed Login: [src] - Banned: ToR")
|
||||
message_admins("\blue Failed Login: [src] - Banned: ToR")
|
||||
//ban their computer_id and ckey for posterity
|
||||
AddBan(ckey(src.key), src.computer_id, "Use of ToR", "Automated Ban", 0, 0)
|
||||
return list("reason"="Using ToR", "desc"="\nReason: The network you are using to connect has been banned.\nIf you believe this is a mistake, please request help at [config.banappeals]")
|
||||
|
||||
|
||||
if(config.ban_legacy_system)
|
||||
//Ban Checking
|
||||
. = CheckBan( ckey(src.key), src.computer_id, src.address )
|
||||
if(.)
|
||||
log_access("Failed Login: [src.key] [src.computer_id] [src.address] - Banned [.["reason"]]")
|
||||
message_admins("\blue Failed Login: [src.key] id:[src.computer_id] ip:[src.address] - Banned [.["reason"]]")
|
||||
return .
|
||||
|
||||
return ..() //default pager ban stuff
|
||||
|
||||
else
|
||||
|
||||
var/ckeytext = ckey(key)
|
||||
|
||||
if(!establish_db_connection())
|
||||
world.log << "Ban database connection failure. Key [ckeytext] not checked"
|
||||
diary << "Ban database connection failure. Key [ckeytext] not checked"
|
||||
return
|
||||
|
||||
var/failedcid = 1
|
||||
var/failedip = 1
|
||||
|
||||
@@ -150,15 +58,16 @@ world/IsBanned(key,address,computer_id)
|
||||
var/duration = query.item[7]
|
||||
var/bantime = query.item[8]
|
||||
var/bantype = query.item[9]
|
||||
|
||||
var/desc = ""
|
||||
var/expires = ""
|
||||
if(text2num(duration) > 0)
|
||||
expires = " The ban is for [duration] minutes and expires on [expiration] (server time)."
|
||||
|
||||
var/desc = "\nReason: You, or another user of this computer or connection ([pckey]) is banned from playing here. The ban reason is:\n[reason]\nThis ban was applied by [ackey] on [bantime], [expires]"
|
||||
|
||||
//return list("reason"="[bantype]", "desc"="[desc]")
|
||||
return "[bantype][desc]"
|
||||
if(config.banappeals)
|
||||
desc = "\nReason: You, or another user of this computer or connection ([pckey]) is banned from playing here. The ban reason is:\n[reason]\nThis ban was applied by [ackey] on [bantime] \nBan type: [bantype] \nExpires: [expires] \nAppeal: [config.banappeals]"
|
||||
else
|
||||
desc = "\nReason: You, or another user of this computer or connection ([pckey]) is banned from playing here. The ban reason is:\n[reason]\nThis ban was applied by [ackey] on [bantime] \nBan type: [bantype] \nExpires: [expires] \nAppeal: \red No ban appeals link set"
|
||||
return list("reason"="[bantype]", "desc"="[desc]")
|
||||
//return "[bantype][desc]"
|
||||
|
||||
if (failedcid)
|
||||
message_admins("[key] has logged in with a blank computer id in the ban check.")
|
||||
|
||||
Reference in New Issue
Block a user