From de7b8c52e7ee88755a0a7f17d9f865a3d41a686f Mon Sep 17 00:00:00 2001 From: Kyep Date: Sun, 3 Nov 2019 01:00:01 -0800 Subject: [PATCH] Add link for newly banned people verifying their forum accounts --- code/modules/admin/topic.dm | 4 ++++ code/modules/client/client procs.dm | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 8db44a1ce53..4abdc89677c 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1002,6 +1002,8 @@ feedback_inc("ban_tmp",1) DB_ban_record(BANTYPE_TEMP, M, mins, reason) feedback_inc("ban_tmp_mins",mins) + if(M.client) + M.client.link_forum_account(TRUE) if(config.banappeals) to_chat(M, "To try to resolve this matter head to [config.banappeals]") else @@ -1018,6 +1020,8 @@ AddBan(M.ckey, M.computer_id, reason, usr.ckey, 0, 0, M.lastKnownIP) to_chat(M, "You have been banned by [usr.client.ckey].\nReason: [reason].") to_chat(M, "This ban does not expire automatically and must be appealed.") + if(M.client) + M.client.link_forum_account(TRUE) if(config.banappeals) to_chat(M, "To try to resolve this matter head to [config.banappeals]") else diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 410109151ba..644ac6aa123 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -622,12 +622,15 @@ return return tokenstr -/client/proc/link_forum_account() +/client/proc/link_forum_account(fromban) + if(!config.forum_link_url) + return if(IsGuestKey(key)) to_chat(src, "Guest keys cannot be linked.") return if(prefs && prefs.fuid) - to_chat(src, "Your forum account is already set.") + if(!fromban) + to_chat(src, "Your forum account is already set.") return var/DBQuery/query_find_link = dbcon.NewQuery("SELECT fuid FROM [format_table_name("player")] WHERE ckey = '[ckey]' limit 1") if(!query_find_link.Execute()) @@ -635,15 +638,19 @@ return if(query_find_link.NextRow()) if(query_find_link.item[1]) - to_chat(src, "Your forum account is already set. (" + query_find_link.item[1] + ")") + if(!fromban) + to_chat(src, "Your forum account is already set. (" + query_find_link.item[1] + ")") return var/tokenid = create_oauth_token() if(!tokenid) to_chat(src, "link_forum_account: unable to create token") return var/url = "[config.forum_link_url][tokenid]" - to_chat(src, {"Now opening a windows to verify your information with the forums. If the window does not load, please go to: [url]."}) - src << link(url) + if(fromban) + to_chat(src, {"Verify your forum account before you appeal: [url] (this link expires in a few minutes)"}) + else + to_chat(src, {"Now opening a window to verify your information with the forums. If the window does not load, please go to: [url]"}) + src << link(url) return #undef TOPIC_SPAM_DELAY