mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-09 16:07:40 +00:00
Merge pull request #13661 from timothyteakettle/age-verification
adds in-game age verification as an alternative to access requests
This commit is contained in:
@@ -78,7 +78,9 @@
|
|||||||
#define EXP_TYPE_ADMIN "Admin"
|
#define EXP_TYPE_ADMIN "Admin"
|
||||||
|
|
||||||
//Flags in the players table in the db
|
//Flags in the players table in the db
|
||||||
#define DB_FLAG_EXEMPT 1
|
#define DB_FLAG_EXEMPT (1<<0)
|
||||||
|
#define DB_FLAG_AGE_CONFIRMATION_INCOMPLETE (1<<1)
|
||||||
|
#define DB_FLAG_AGE_CONFIRMATION_COMPLETE (1<<2)
|
||||||
|
|
||||||
#define DEFAULT_CYBORG_NAME "Default Cyborg Name"
|
#define DEFAULT_CYBORG_NAME "Default Cyborg Name"
|
||||||
|
|
||||||
|
|||||||
@@ -327,6 +327,9 @@
|
|||||||
/datum/config_entry/number/notify_new_player_account_age // how long do we notify admins of a new byond account
|
/datum/config_entry/number/notify_new_player_account_age // how long do we notify admins of a new byond account
|
||||||
min_val = 0
|
min_val = 0
|
||||||
|
|
||||||
|
/datum/config_entry/flag/age_verification //are we using the automated age verification which asks users if they're 18+?
|
||||||
|
config_entry_value = TRUE
|
||||||
|
|
||||||
/datum/config_entry/flag/irc_first_connection_alert // do we notify the irc channel when somebody is connecting for the first time?
|
/datum/config_entry/flag/irc_first_connection_alert // do we notify the irc channel when somebody is connecting for the first time?
|
||||||
|
|
||||||
/datum/config_entry/flag/check_randomizer
|
/datum/config_entry/flag/check_randomizer
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
|
|||||||
var/away_name
|
var/away_name
|
||||||
var/datum/space_level/away_level
|
var/datum/space_level/away_level
|
||||||
|
|
||||||
var/answer = input("What kind ? ","Away/VR") as null|anything in (possible_options + "Custom")
|
var/answer = input("What kind ? ","Away/VR") as null|anything in list(possible_options + "Custom")
|
||||||
switch(answer)
|
switch(answer)
|
||||||
if(null)
|
if(null)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
|||||||
else
|
else
|
||||||
prefs = new /datum/preferences(src)
|
prefs = new /datum/preferences(src)
|
||||||
GLOB.preferences_datums[ckey] = prefs
|
GLOB.preferences_datums[ckey] = prefs
|
||||||
|
|
||||||
addtimer(CALLBACK(src, .proc/ensure_keys_set), 10) //prevents possible race conditions
|
addtimer(CALLBACK(src, .proc/ensure_keys_set), 10) //prevents possible race conditions
|
||||||
|
|
||||||
prefs.last_ip = address //these are gonna be used for banning
|
prefs.last_ip = address //these are gonna be used for banning
|
||||||
@@ -561,36 +561,49 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
|
|||||||
if(!query_client_in_db.Execute())
|
if(!query_client_in_db.Execute())
|
||||||
qdel(query_client_in_db)
|
qdel(query_client_in_db)
|
||||||
return
|
return
|
||||||
if(!query_client_in_db.NextRow())
|
if(!query_client_in_db.NextRow()) //new user detected
|
||||||
if (CONFIG_GET(flag/panic_bunker) && !holder && !GLOB.deadmins[ckey] && !(ckey in GLOB.bunker_passthrough))
|
if(!holder && !GLOB.deadmins[ckey])
|
||||||
log_access("Failed Login: [key] - New account attempting to connect during panic bunker")
|
if(CONFIG_GET(flag/panic_bunker) && !(ckey in GLOB.bunker_passthrough))
|
||||||
message_admins("<span class='adminnotice'>Failed Login: [key] - New account attempting to connect during panic bunker</span>")
|
log_access("Failed Login: [key] - New account attempting to connect during panic bunker")
|
||||||
to_chat(src, "<span class='notice'>You must first join the Discord to verify your account before joining this server.<br>To do so, read the rules and post a request in the #station-access-requests channel under the \"Main server\" category in the Discord server linked here: <a href='https://discord.gg/E6SQuhz'>https://discord.gg/E6SQuhz</a><br>If you have already done so, wait a few minutes then try again; sometimes the server needs to fully load before you can join.</span>") //CIT CHANGE - makes the panic bunker disconnect message point to the discord
|
message_admins("<span class='adminnotice'>Failed Login: [key] - New account attempting to connect during panic bunker</span>")
|
||||||
var/list/connectiontopic_a = params2list(connectiontopic)
|
to_chat(src, "<span class='notice'>You must first join the Discord to verify your account before joining this server.<br>To do so, read the rules and post a request in the #station-access-requests channel under the \"Main server\" category in the Discord server linked here: <a href='https://discord.gg/E6SQuhz'>https://discord.gg/E6SQuhz</a><br>If you have already done so, wait a few minutes then try again; sometimes the server needs to fully load before you can join.</span>") //CIT CHANGE - makes the panic bunker disconnect message point to the discord
|
||||||
var/list/panic_addr = CONFIG_GET(string/panic_server_address)
|
var/list/connectiontopic_a = params2list(connectiontopic)
|
||||||
if(panic_addr && !connectiontopic_a["redirect"])
|
var/list/panic_addr = CONFIG_GET(string/panic_server_address)
|
||||||
var/panic_name = CONFIG_GET(string/panic_server_name)
|
if(panic_addr && !connectiontopic_a["redirect"])
|
||||||
to_chat(src, "<span class='notice'>Sending you to [panic_name ? panic_name : panic_addr].</span>")
|
var/panic_name = CONFIG_GET(string/panic_server_name)
|
||||||
winset(src, null, "command=.options")
|
to_chat(src, "<span class='notice'>Sending you to [panic_name ? panic_name : panic_addr].</span>")
|
||||||
src << link("[panic_addr]?redirect=1")
|
winset(src, null, "command=.options")
|
||||||
qdel(query_client_in_db)
|
src << link("[panic_addr]?redirect=1")
|
||||||
qdel(src)
|
qdel(query_client_in_db)
|
||||||
return
|
qdel(src)
|
||||||
|
return
|
||||||
|
|
||||||
new_player = 1
|
new_player = 1
|
||||||
account_join_date = sanitizeSQL(findJoinDate())
|
account_join_date = sanitizeSQL(findJoinDate())
|
||||||
var/sql_key = sanitizeSQL(key)
|
var/sql_key = sanitizeSQL(key)
|
||||||
var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `byond_key`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', '[sql_key]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])")
|
var/datum/DBQuery/query_add_player = SSdbcore.NewQuery("INSERT INTO [format_table_name("player")] (`ckey`, `byond_key`, `firstseen`, `firstseen_round_id`, `lastseen`, `lastseen_round_id`, `ip`, `computerid`, `lastadminrank`, `accountjoindate`) VALUES ('[sql_ckey]', '[sql_key]', Now(), '[GLOB.round_id]', Now(), '[GLOB.round_id]', INET_ATON('[sql_ip]'), '[sql_computerid]', '[sql_admin_rank]', [account_join_date ? "'[account_join_date]'" : "NULL"])")
|
||||||
if(!query_add_player.Execute())
|
if(!query_add_player.Execute())
|
||||||
qdel(query_client_in_db)
|
qdel(query_client_in_db)
|
||||||
|
qdel(query_add_player)
|
||||||
|
return
|
||||||
qdel(query_add_player)
|
qdel(query_add_player)
|
||||||
return
|
if(!account_join_date)
|
||||||
qdel(query_add_player)
|
account_join_date = "Error"
|
||||||
if(!account_join_date)
|
account_age = -1
|
||||||
account_join_date = "Error"
|
else if(ckey in GLOB.bunker_passthrough)
|
||||||
account_age = -1
|
GLOB.bunker_passthrough -= ckey
|
||||||
else if(ckey in GLOB.bunker_passthrough)
|
if(CONFIG_GET(flag/age_verification)) //setup age verification
|
||||||
GLOB.bunker_passthrough -= ckey
|
if(!set_db_player_flags())
|
||||||
|
message_admins(usr, "<span class='danger'>ERROR: Unable to read player flags from database. Please check logs.</span>")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
var/dbflags = prefs.db_flags
|
||||||
|
if(!(dbflags & DB_FLAG_AGE_CONFIRMATION_COMPLETE)) //they have not completed age verification
|
||||||
|
if((ckey in GLOB.bunker_passthrough)) //they're verified in the panic bunker though
|
||||||
|
update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE)
|
||||||
|
else
|
||||||
|
update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, TRUE)
|
||||||
|
|
||||||
qdel(query_client_in_db)
|
qdel(query_client_in_db)
|
||||||
var/datum/DBQuery/query_get_client_age = SSdbcore.NewQuery("SELECT firstseen, DATEDIFF(Now(),firstseen), accountjoindate, DATEDIFF(Now(),accountjoindate) FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'")
|
var/datum/DBQuery/query_get_client_age = SSdbcore.NewQuery("SELECT firstseen, DATEDIFF(Now(),firstseen), accountjoindate, DATEDIFF(Now(),accountjoindate) FROM [format_table_name("player")] WHERE ckey = '[sql_ckey]'")
|
||||||
if(!query_get_client_age.Execute())
|
if(!query_get_client_age.Execute())
|
||||||
|
|||||||
@@ -78,6 +78,28 @@
|
|||||||
popup.set_content(output)
|
popup.set_content(output)
|
||||||
popup.open(FALSE)
|
popup.open(FALSE)
|
||||||
|
|
||||||
|
/mob/dead/new_player/proc/age_verify()
|
||||||
|
if(CONFIG_GET(flag/age_verification)) //make sure they are verified
|
||||||
|
if(!client.set_db_player_flags())
|
||||||
|
message_admins("Blocked [src] from new player panel because age verification could not access player database flags.")
|
||||||
|
return FALSE
|
||||||
|
else
|
||||||
|
var/dbflags = client.prefs.db_flags
|
||||||
|
if(dbflags & DB_FLAG_AGE_CONFIRMATION_INCOMPLETE) //they have not completed age verification
|
||||||
|
var/age_verification = askuser(src, "Are you 18+", "Age Verification", "I am 18+", "I am not 18+", null, TRUE, null)
|
||||||
|
if(age_verification != "1")
|
||||||
|
create_message("note", ckey, "Server - Automated Age Verification", "Failed age verification.", null, null, TRUE, TRUE, null, "9999-01-01", "High") //log this occurence
|
||||||
|
qdel(client) //kick the user
|
||||||
|
return FALSE
|
||||||
|
else
|
||||||
|
//they claim to be of age, so allow them to continue and update their flags
|
||||||
|
client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_COMPLETE, TRUE)
|
||||||
|
client.update_flag_db(DB_FLAG_AGE_CONFIRMATION_INCOMPLETE, FALSE)
|
||||||
|
//log this
|
||||||
|
message_admins("[ckey] has joined through the automated age verification process.")
|
||||||
|
return TRUE
|
||||||
|
return TRUE
|
||||||
|
|
||||||
/mob/dead/new_player/Topic(href, href_list[])
|
/mob/dead/new_player/Topic(href, href_list[])
|
||||||
if(src != usr)
|
if(src != usr)
|
||||||
return 0
|
return 0
|
||||||
@@ -85,6 +107,9 @@
|
|||||||
if(!client)
|
if(!client)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
if(!age_verify())
|
||||||
|
return
|
||||||
|
|
||||||
//Determines Relevent Population Cap
|
//Determines Relevent Population Cap
|
||||||
var/relevant_cap
|
var/relevant_cap
|
||||||
var/hpc = CONFIG_GET(number/hard_popcap)
|
var/hpc = CONFIG_GET(number/hard_popcap)
|
||||||
|
|||||||
@@ -375,6 +375,9 @@ NOTIFY_NEW_PLAYER_ACCOUNT_AGE 1
|
|||||||
##Name of the place to send people rejected by the bunker
|
##Name of the place to send people rejected by the bunker
|
||||||
#PANIC_SERVER_NAME [Put the name here]
|
#PANIC_SERVER_NAME [Put the name here]
|
||||||
|
|
||||||
|
##Automated age verification, comment this out to not ask new users if they are 18+
|
||||||
|
AGE_VERIFICATION
|
||||||
|
|
||||||
## Uncomment to have the changelog file automatically open when a user connects and hasn't seen the latest changelog
|
## Uncomment to have the changelog file automatically open when a user connects and hasn't seen the latest changelog
|
||||||
#AGGRESSIVE_CHANGELOG
|
#AGGRESSIVE_CHANGELOG
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user