mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-30 00:21:11 +01:00
Implement forum-user-auth for game (#20875)
Requires https://github.com/Aurorastation/Web-Interface/pull/136 be merged. Allows users to authenticate themselves using only the forum. It will generate a custom ckey for these users in the form of `GuestF-[ckey(forum-nickname)]`. This will be saved into the database and will act as a normal ckey from thereon out. These ckeys will be marked in the player table, to allow for later filtering. This will also modify the config parameter external_auth to be an enum of 3 values. Open questions: can we do automatic linking from purely the game side? Since upon creation of the custom ckey, it should also be linked back to the forums. --------- Co-authored-by: Erki <erki@skullnet.me>
This commit is contained in:
@@ -189,24 +189,37 @@
|
||||
var/mob/abstract/unauthed/una = GLOB.unauthed[queryparams["clienttoken"]]
|
||||
if(!istype(una) || !una.client)
|
||||
statuscode = 500
|
||||
response = "Somethnig went horribly wrong."
|
||||
response = "Something went horribly wrong."
|
||||
return TRUE
|
||||
|
||||
if(!GLOB.config.external_auth)
|
||||
statuscode = 500
|
||||
response = "External auth is disalowed."
|
||||
response = "External auth is disallowed."
|
||||
del(una.client)
|
||||
del(una)
|
||||
return TRUE
|
||||
|
||||
var/client/cl = GLOB.directory[ckey(queryparams["key"])]
|
||||
var/ckey_is_external = queryparams["use-external-key"]
|
||||
|
||||
if(ckey_is_external && GLOB.config.external_auth != 2)
|
||||
statuscode = 403
|
||||
response = "External auth is disabled for users without linked ckeys."
|
||||
del(una.client)
|
||||
del(una)
|
||||
return TRUE
|
||||
|
||||
var/ckey_to_apply = queryparams["key"]
|
||||
if (ckey_is_external && ckey_to_apply == null)
|
||||
ckey_to_apply = "GuestF-[ckey(queryparams["forumuser"])]"
|
||||
|
||||
var/client/cl = GLOB.directory[ckey(ckey_to_apply)]
|
||||
if(cl)
|
||||
to_chat(cl, "Another connection has been made using your login key. This session has been terminated.")
|
||||
del(cl)
|
||||
|
||||
statuscode = 200
|
||||
response = "Client has been authenticated sucessfully."
|
||||
una.ClientLogin(queryparams["key"])
|
||||
una.ClientLogin(ckey_to_apply, ckey_is_external)
|
||||
|
||||
// Authenticates client from external system
|
||||
/datum/topic_command/get_auth_client_ip
|
||||
|
||||
Reference in New Issue
Block a user