summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-12-13 18:29:28 -0300
committerJesusaves <cpntb1@ymail.com>2021-12-13 18:29:28 -0300
commit47abbbe1894d373358b2db780cefdb25a9a9de0c (patch)
tree9cfcf2e483f8621855128f926322b9fea1311abc
parentaeb4a95746cfd1c1073a6dcd9cee972e5bdfc59c (diff)
downloadrenpy-47abbbe1894d373358b2db780cefdb25a9a9de0c.tar.gz
renpy-47abbbe1894d373358b2db780cefdb25a9a9de0c.tar.bz2
renpy-47abbbe1894d373358b2db780cefdb25a9a9de0c.tar.xz
renpy-47abbbe1894d373358b2db780cefdb25a9a9de0c.zip
Prepare support for multiple authentication methods
-rw-r--r--game/core.rpy8
-rw-r--r--game/screens.rpy16
-rw-r--r--game/update.rpy62
3 files changed, 62 insertions, 24 deletions
diff --git a/game/core.rpy b/game/core.rpy
index ebae01b..cc99da5 100644
--- a/game/core.rpy
+++ b/game/core.rpy
@@ -142,12 +142,20 @@ init -3 python:
persistent.discord = True
if (persistent.steam is None):
persistent.steam = False
+ if (persistent.google is None):
+ persistent.google = False
if (persistent.evol2cli is None):
persistent.evol2cli = "manaverse"
if (persistent.iconify is None):
persistent.iconify = ifte(renpy.windows, False, True)
#############################################################################
+ ## Fail-safe
+ if persistent.steam and persistent.google:
+ persistent.steam = False
+ persistent.google = False
+
+ #############################################################################
## Conditional imports
if persistent.steam:
import _renpysteam as steam
diff --git a/game/screens.rpy b/game/screens.rpy
index b7dc2be..50225a2 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -671,11 +671,17 @@ screen preferences():
_("Disabled")):
action ToggleVariable("persistent.discord")
null height 10
- label _("Steam Login")
- textbutton ifte(persistent.steam,
- _("Enabled"),
- _("Disabled")):
- action ToggleVariable("persistent.steam")
+ label _("Login Method: %s" % ifte(persistent.steam, "Steam", ifte(persistent.google, "Google", "Built-In")))
+ textbutton _("Steam") action [SetVariable("persistent.steam", True), SetVariable("persistent.google", False)] selected persistent.steam
+ if config.developer:
+ textbutton _("Google Auth") action [SetVariable("persistent.steam", False), SetVariable("persistent.google", True)] selected persistent.google
+ textbutton _("Built-In") action [SetVariable("persistent.steam", False), SetVariable("persistent.google", False)] selected (not persistent.steam and not persistent.google)
+
+ #label _("Steam Login")
+ #textbutton ifte(persistent.steam,
+ # _("Enabled"),
+ # _("Disabled")):
+ # action ToggleVariable("persistent.steam")
null height 10
label _("Plugins")
null height 7
diff --git a/game/update.rpy b/game/update.rpy
index 3a7e37f..626c41a 100644
--- a/game/update.rpy
+++ b/game/update.rpy
@@ -184,6 +184,19 @@ init python:
# Before starting, we must check for Vault or Steam credentials
# This block is 1~20%
status_update(_("Verifying credentials..."), 80)
+ if persistent.steam:
+ auth_steam()
+ elif persistent.google:
+ auth_google()
+ else:
+ auth_vault()
+
+ return
+
+ #############################################################################
+ def auth_steam():
+ global accId, token, auth, r, responsive, auth2
+ global vaultId, vaultToken, has_steam
try:
if not persistent.steam:
raise Exception("Steam login was disabled!")
@@ -240,31 +253,42 @@ init python:
time.sleep(0.25)
except:
# NO FALLBACK: if Steam Login is on, do not try vault (no multiacc)
- if persistent.steam:
- traceback.print_exc()
- status_update(_("{color=#f00}{b}STEAM AUTHENTICATION ERROR.\nIf the issue persists, try closing the app and opening again.{/b}{/color}"))
- responsive=False
- return
+ traceback.print_exc()
+ status_update(_("{color=#f00}{b}STEAM AUTHENTICATION ERROR.\nIf the issue persists, try closing the app and opening again.{/b}{/color}"))
+ responsive=False
+ return
+
+ status_update(pc=100)
+ return
- # Prepare to do Vault authentication
- status_update(_("Steam auth disabled, logging on Vault..."), 80)
- vaultId = 0
- vaultToken = "MANUAL"
- #########################################
- ####### TODO FIXME
- # Must return and let a prompt for username & password
- # (Or Email, in the case of the modern Vault)
- # If vaultId is zero
- #status_update("{color=#F00}VaultError: Not yet implemented{/color}")
- #responsive = False
- #return
- ####### TODO FIXME
- #########################################
+ #############################################################################
+ def auth_vault():
+ global vaultId, vaultToken
+ # Prepare to do Vault authentication
+ status_update(_("Steam auth disabled, logging on Vault..."), 80)
+ vaultId = 0
+ vaultToken = "MANUAL"
+ #########################################
+ ####### TODO FIXME
+ # Must return and let a prompt for username & password
+ # (Or Email, in the case of the modern Vault)
+ # If vaultId is zero
+ #status_update("{color=#F00}VaultError: Not yet implemented{/color}")
+ #responsive = False
+ #return
+ ####### TODO FIXME
+ #########################################
status_update(pc=100)
return
+ #############################################################################
+ def auth_google():
+ global vaultId, vaultToken, responsive
+ status_update(_("Not yet implemented."), 80)
+ responsive = False
+ return
#################################################################################
screen register_method():