Generates parity between remote auth login chain and the normal login chain (#8802)

Fixes #8773
Fixes #7895
This commit is contained in:
Erki
2020-05-06 16:15:56 +03:00
committed by GitHub
parent 96f7055355
commit 4b327dcfe9
28 changed files with 109 additions and 44 deletions
+2
View File
@@ -75,3 +75,5 @@
var/obj/screen/plane_master/parallax_spacemaster/parallax_spacemaster = null
var/authed = TRUE
var/is_initialized = FALSE // Used to track whether the client has been initialized with InitClient.
+5 -2
View File
@@ -350,17 +350,18 @@
return 0
if(IsGuestKey(key) && config.external_auth)
//src.real_mob = ..()
src.authed = FALSE
var/mob/abstract/unauthed/m = new()
m.client = src
src.InitPrefs() //Init some default prefs
m.LateLogin()
return m
//Do auth shit
else
. = ..()
src.InitClient()
src.InitPrefs()
. = ..()
mob.LateLogin()
/client/proc/InitPrefs()
//preferences datum - also holds some persistant data for the client (because we may as well keep these datums to a minimum)
@@ -446,6 +447,8 @@
fetch_unacked_warning_count()
is_initialized = TRUE
//////////////
//DISCONNECT//
//////////////
@@ -24,7 +24,9 @@
/mob/abstract/new_player
var/client/my_client // Need to keep track of this ourselves, since by the time Logout() is called the client has already been nulled
/mob/abstract/new_player/Login()
/mob/abstract/new_player/LateLogin()
..()
update_Login_details() //handles setting lastKnownIP and computer_id for use by the ban systems as well as checking for multikeying
to_chat(src, "<div class='info'>Game ID: <div class='danger'>[game_id]</div></div>")
+1 -1
View File
@@ -1,4 +1,4 @@
/mob/abstract/observer/Login()
/mob/abstract/observer/LateLogin()
..()
if (ghostimage)
ghostimage.icon_state = src.icon_state
+15 -7
View File
@@ -8,7 +8,9 @@
/mob/abstract/unauthed/New()
verbs -= typesof(/mob/verb)
/mob/abstract/unauthed/Login()
/mob/abstract/unauthed/LateLogin()
SHOULD_CALL_PARENT(FALSE)
update_Login_details()
to_chat(src, "<span class='danger'><b>You need to authenticate before you can continue.</b></span>")
token = md5("[client.ckey][client.computer_id][world.time][rand()]")
@@ -34,11 +36,12 @@
if(!client)
qdel(src)
deltimer(timeout_timer)
var/client/c = client
var/client/c = client // so we don't lose the client in the current mob.
show_browser(src, null, "window=auth;")
client.verbs += typesof(/client/verb) // Let's return regular client verbs
client.authed = TRUE // We declare client as authed now
client.prefs = null //Null them so we can load them from the db again for the correct ckey
c.verbs += typesof(/client/verb) // Let's return regular client verbs
c.authed = TRUE // We declare client as authed now
c.prefs = null //Null them so we can load them from the db again for the correct ckey
// Check for bans
var/list/ban_data = world.IsBanned(ckey(newkey), c.address, c.computer_id, 1, TRUE)
if(ban_data)
@@ -47,14 +50,19 @@
to_chat(c, "Description: [ban_data["desc"]]")
del(c)
return
directory -= client.ckey
directory -= c.ckey
if(newkey)
client.key = newkey // Try seeting ckey
c.key = newkey // Try seeting ckey
// ^^^^ THIS INVOKES mob/Login()!
// and also modifies the c.mob to the actual mob they disconnected out of.
directory[c.ckey] = c
// Init the client and give it a new_player mob.
// Note that modifying the key variable does not invoke client/New() or client/Login() again.
c.InitClient()
c.InitPrefs()
c.mob.LateLogin()
if(istype(c.mob, /mob/abstract/unauthed))
c.mob = new /mob/abstract/new_player()
@@ -1,3 +1,3 @@
/mob/living/carbon/brain/Login()
/mob/living/carbon/brain/LateLogin()
..()
sleeping = 0
sleeping = 0
@@ -1,5 +1,5 @@
/mob/living/carbon/human/Login()
/mob/living/carbon/human/LateLogin()
..()
update_hud()
if(species) species.handle_login_special(src)
return
return
@@ -1,4 +1,4 @@
/mob/living/carbon/human/Logout()
..()
if(species) species.handle_logout_special(src)
return
if(species)
species.handle_logout_special(src)
@@ -1,4 +1,4 @@
/mob/living/carbon/slime/Login()
/mob/living/carbon/slime/LateLogin()
..()
update_hud()
return
return
+1 -1
View File
@@ -1,5 +1,5 @@
/mob/living/Login()
/mob/living/LateLogin()
..()
//Mind updates
mind_initialize() //updates the mind (or creates and initializes one if one doesn't exist)
+1 -1
View File
@@ -23,7 +23,7 @@ var/controlling
/mob/living/parasite
var/mob/living/carbon/host // the host that this parasite occupies
/mob/living/parasite/Login()
/mob/living/parasite/LateLogin()
..()
// make the client see through the host instead
client.eye = host
+1 -1
View File
@@ -1,4 +1,4 @@
/mob/living/silicon/ai/Login() //ThisIsDumb(TM) TODO: tidy this up ¬_¬ ~Carn
/mob/living/silicon/ai/LateLogin() //ThisIsDumb(TM) TODO: tidy this up ¬_¬ ~Carn // It's still dumb and not really tidied up. Enjoy!
..()
regenerate_icons()
flash = new /obj/screen()
@@ -7,4 +7,3 @@
client.eye = loc
client.perspective = EYE_PERSPECTIVE
src.view_core()
return
+2 -2
View File
@@ -1,3 +1,3 @@
/mob/living/silicon/Login()
/mob/living/silicon/LateLogin()
sleeping = FALSE
..()
..()
+1 -1
View File
@@ -166,7 +166,7 @@
id_card.registered_name = ""
/mob/living/silicon/pai/Login()
/mob/living/silicon/pai/LateLogin()
greet()
..()
@@ -1,4 +1,4 @@
/mob/living/silicon/robot/Login()
/mob/living/silicon/robot/LateLogin()
..()
regenerate_icons()
show_laws(0)
@@ -8,4 +8,4 @@
// Forces synths to select an icon relevant to their module
if(module && !icon_selected)
choose_icon()
choose_icon()
@@ -38,7 +38,7 @@
/mob/living/simple_animal/borer/roundstart
roundstart = TRUE
/mob/living/simple_animal/borer/Login()
/mob/living/simple_animal/borer/LateLogin()
..()
if(mind)
borers.add_antagonist(mind)
@@ -158,4 +158,4 @@
G.request_player(src, "A cortical borer needs a player.")
/mob/living/simple_animal/borer/cannot_use_vents()
return
return
@@ -148,7 +148,7 @@
turns_since_move = turns_per_move
..()
/mob/living/simple_animal/Login()
/mob/living/simple_animal/LateLogin()
if(src && src.client)
src.client.screen = null
..()
+30 -1
View File
@@ -23,7 +23,37 @@
message_admins("<font color='red'><B>Notice: </B></font><font color='blue'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same [matches] as [key_name_admin(M)] (no longer logged in). </font>", 1)
log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).",ckey=key_name(src))
/**
* Currently marked as SHOULD_NOT_OVERRIDE.
*
* In the case of Aurora code, mob/Login is invoked BEFORE client initialization
* is completed, in order to permit remote authentication.
*
* This also invokes mob/proc/LateLogin in cases where the client has already been
* initialized. This is the case when a ckey is moved around from mob to mob during
* gameplay.
*
* Use /mob/proc/LateLogin() instead.
*/
/mob/Login()
SHOULD_NOT_OVERRIDE(TRUE)
..()
if (client.is_initialized)
LateLogin()
/**
* \brief A function to replace most uses of mob/Login with. 99% of the time, you
* should implement an override of this function.
*
* This function is invoked AFTER client/proc/InitClient and client/proc/InitPrefs.
* It can expect the client.ckey to be properly populated with the client's final
* ckey.
*/
/mob/proc/LateLogin()
SHOULD_CALL_PARENT(TRUE)
player_list |= src
update_Login_details()
SSfeedback.update_status()
@@ -38,7 +68,6 @@
next_move = 1
sight |= SEE_SELF
disconnect_time = null
..()
player_age = client.player_age
+2 -1
View File
@@ -1,4 +1,6 @@
/mob/Logout()
SHOULD_CALL_PARENT(TRUE)
SSnanoui.user_logout(src) // this is used to clean up (remove) this user's Nano UIs
player_list -= src
disconnect_time = world.realtime
@@ -27,4 +29,3 @@
if (mob_thinks)
MOB_START_THINKING(src)
..()
return 1
+2 -2
View File
@@ -1,8 +1,8 @@
/mob/living
var/datum/psi_complexus/psi
/mob/living/Login()
. = ..()
/mob/living/LateLogin()
..()
if(psi)
psi.update(TRUE)
if(!psi.suppressed)
+2 -2
View File
@@ -7,7 +7,7 @@
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
spell_master.update_spells(0, src)
/mob/Login()
/mob/LateLogin()
..()
if(spell_masters)
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
@@ -85,4 +85,4 @@
return
for(var/obj/screen/movable/spell_master/spell_master in spell_masters)
spell_master.silence_spells(amount)
spell_master.silence_spells(amount)
+2 -2
View File
@@ -23,8 +23,8 @@ var/global/list/can_enter_vent_with = list(
/mob/living/proc/can_ventcrawl()
return 0
/mob/living/Login()
. = ..()
/mob/living/LateLogin()
..()
//login during ventcrawl
if(is_ventcrawling && istype(loc, /obj/machinery/atmospherics)) //attach us back into the pipes
remove_ventcrawl()