mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 05:23:22 +01:00
Offline Authentication Fixes (For real this time) (#20769)
Thanks to harry for pointing me in the right direction here. The way this worked previously, is that it bypassed the UI initialization. I ended up moving all of that into a seperate proc, which is now also called upon logging in with the offline authenticator (after prefs are loaded). In addition, I improved the login window. Instead of having a closable pop-up window (which was only made closable due to a bug with it staying open), it is now integrated into the game window itself (and I fixed the bug requiring it to be closable). There was also an unclosed `<body>` tag which I closed, and all the elements previously sent to the (now blocked) chat window, instead appear on the window itself.
This commit is contained in:
@@ -11,24 +11,33 @@ GLOBAL_LIST_EMPTY(unauthed)
|
||||
/mob/abstract/unauthed/LateLogin()
|
||||
SHOULD_CALL_PARENT(FALSE)
|
||||
|
||||
//Don't redo this if they have already been authenticated
|
||||
if(client?.authed)
|
||||
return
|
||||
|
||||
update_Login_details()
|
||||
to_chat(src, SPAN_DANGER("<b>You need to authenticate before you can continue.</b>"))
|
||||
token = md5("[client.ckey][client.computer_id][world.time][rand()]")
|
||||
GLOB.unauthed[token] = src
|
||||
remove_verb(client, typesof(/client/verb))
|
||||
var/uihtml = "<html><head><style>body * {display: block;text-align:center;margin: 14px 0;font-size:24px;text-decoration:none;font-family:Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;}</style></head><body><p>Please select:</p>"
|
||||
var/uihtml = "<html><head><style>body * {display: block;text-align:center;margin: 14px 0;font-size:24px;text-decoration:none;font-family:Segoe UI Variable,Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;}h1{color: #ff0000;font-family:Segoe UI Variable,Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;}</style></head>"
|
||||
uihtml += "<body><h1>You need to authenticate before you can continue.</h1><br/><p>Please select:</p>"
|
||||
if(GLOB.config.guests_allowed)
|
||||
uihtml += "<a href='byond://?src=[REF(src)];authaction=guest'>Login as guest</a>"
|
||||
if(GLOB.config.webint_url && GLOB.config.external_auth)
|
||||
uihtml += "<a href='byond://?src=[REF(src)];authaction=forums'>Login via forums</a>"
|
||||
if(!GLOB.config.guests_allowed && GLOB.config.webint_url && GLOB.config.external_auth)
|
||||
src.OpenForumAuthWindow()
|
||||
show_browser(src, uihtml, "window=externalauth;size=300x300;border=0;can_close=1;can_resize=0;can_minimize=0;titlebar=1")
|
||||
timeout_timer = addtimer(CALLBACK(src, PROC_REF(timeout)), 900, TIMER_STOPPABLE)
|
||||
uihtml += "</body>"
|
||||
show_browser(src, uihtml, "window=mainwindow.guestbrowser")
|
||||
winset(src, "mainwindow.guestbrowser", "is-visible=true")
|
||||
winset(src, "mainwindow.guestbrowser", "is-disabled=false")
|
||||
timeout_timer = addtimer(CALLBACK(src, PROC_REF(timeout)), 90 SECONDS, TIMER_STOPPABLE)
|
||||
|
||||
/mob/abstract/unauthed/proc/timeout()
|
||||
if (client)
|
||||
to_chat_immediate(client, "Your login time has expired. Please relog and try again.")
|
||||
var/alert = "<html><head><title>Login Timeout</title><style>body * {display: block;text-align:center;margin: 14px 0;font-size:24px;text-decoration:none;font-family:Segoe UI Variable,Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;}h1{color: #ff0000;font-family:Segoe UI Variable,Segoe UI,Frutiger,Frutiger Linotype,Dejavu Sans,Helvetica Neue,Arial,sans-serif;}</style></head>"
|
||||
alert += "<body><h1>Your login time has expired. Please relog and try again.</h1></body>"
|
||||
show_browser(src, alert, "window=mainwindow.guestbrowser;")
|
||||
qdel(client)
|
||||
qdel(src)
|
||||
|
||||
@@ -36,10 +45,12 @@ GLOBAL_LIST_EMPTY(unauthed)
|
||||
if(!client)
|
||||
qdel(src)
|
||||
deltimer(timeout_timer)
|
||||
winset(src, "mainwindow.guestbrowser", "is-visible=false")
|
||||
winset(src, "mainwindow.guestbrowser", "is-disabled=true")
|
||||
var/client/c = client // so we don't lose the client in the current mob.
|
||||
|
||||
show_browser(src, null, "window=externalauth")
|
||||
add_verb(c, 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
|
||||
@@ -62,6 +73,7 @@ GLOBAL_LIST_EMPTY(unauthed)
|
||||
// Note that modifying the key variable does not invoke client/New() or client/Login() again.
|
||||
c.InitClient()
|
||||
c.InitPrefs()
|
||||
c.InitUI()
|
||||
c.mob.LateLogin()
|
||||
|
||||
if(istype(c.mob, /mob/abstract/unauthed))
|
||||
|
||||
Reference in New Issue
Block a user