summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-12-18 18:14:18 -0300
committerJesusaves <cpntb1@ymail.com>2021-12-18 18:14:18 -0300
commit61e476563f30def0435341f9e72490bf81348ba4 (patch)
tree07fb6ac43bd6bff553da793fcf56398ab3ae62d6
parent522d5be410bc951b62df9f6d46603937108da932 (diff)
downloadrenpy-61e476563f30def0435341f9e72490bf81348ba4.tar.gz
renpy-61e476563f30def0435341f9e72490bf81348ba4.tar.bz2
renpy-61e476563f30def0435341f9e72490bf81348ba4.tar.xz
renpy-61e476563f30def0435341f9e72490bf81348ba4.zip
Remember password (unsafe)
-rw-r--r--game/screens.rpy3
-rw-r--r--game/update.rpy9
-rw-r--r--game/vault.rpy24
3 files changed, 33 insertions, 3 deletions
diff --git a/game/screens.rpy b/game/screens.rpy
index aaa9dc6..68e0d3c 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -708,6 +708,9 @@ screen preferences():
textbutton _("Remember Mail %s" % ifte(
persistent.email is not None, _("ON"), _("OFF"))):
action Function(renpy.call_in_new_context, "resetm")
+ textbutton _("Remember Pass %s" % ifte(
+ persistent.passd is not None, _("ON"), _("OFF"))):
+ action Function(renpy.call_in_new_context, "resetp")
textbutton "{size=20}"+_("Reset Login Method")+"{/size}":
action Function(renpy.call_in_new_context, "savevm")
null height 12
diff --git a/game/update.rpy b/game/update.rpy
index 3c73800..16e0cf9 100644
--- a/game/update.rpy
+++ b/game/update.rpy
@@ -485,7 +485,12 @@ label savevm:
return
label resetm:
- $ persistent.email = ""
- $ persistent.passd = ""
+ $ persistent.email = None
+ return
+
+label resetp:
+ $ persistent.rhash = None
+ $ persistent.passd = None
+ $ persistent.sub = None
return
diff --git a/game/vault.rpy b/game/vault.rpy
index 9e24573..d6477f8 100644
--- a/game/vault.rpy
+++ b/game/vault.rpy
@@ -9,7 +9,8 @@
default uedit = {"mail": "",
"pasd": "",
"totp": "",
- "rbmx": ifte(persistent.email is None, False, True)}
+ "rbmx": ifte(persistent.email is None, False, True),
+ "rbpd": ifte(persistent.passd is None, False, True)}
init python:
def ueditor_input(key, temp="", tp="str"):
@@ -51,6 +52,10 @@ init python:
# Conditional hacks
if (persistent.email is not None and self.variable == "a@a.com"):
self.variable = str(persistent.email)
+ uedit[key] = str(self.variable)
+ if (persistent.passd is not None and self.variable == "***"):
+ self.variable = str(bytearray((x ^ (persistent.rhash/persistent.sub) for x in bytearray(persistent.passd, 'utf-8'))))
+ uedit[key] = str(self.variable)
def get_text(self):
try:
@@ -145,6 +150,18 @@ screen register_vault():
null width 5
text _("Remember email") size 18
action [SetDict(uedit, "rbmx", not uedit["rbmx"]), Function(renpy.restart_interaction)]
+ button:
+ #xmaximum 32
+ #ymaximum 32
+ hbox:
+ spacing 10
+ if (uedit["rbpd"]):
+ add "gui/button/check_1.png"
+ else:
+ add "gui/button/check_0.png"
+ null width 5
+ text _("Remember password (unsafe!)") size 18
+ action [SetDict(uedit, "rbpd", not uedit["rbpd"]), Function(renpy.restart_interaction)]
hbox:
xalign 0.5
@@ -183,6 +200,11 @@ label register_vault:
# We save the variables on the meanwhile
if uedit["rbmx"]:
$ persistent.email = str(email)
+ if uedit["rbpd"]:
+ $ hsh = renpy.random.randint(11, 63)
+ $ persistent.sub = renpy.random.randint(127, 2048)
+ $ persistent.rhash = int(hsh)*persistent.sub
+ $ persistent.passd = str(bytearray(x ^ hsh for x in bytearray(password, 'utf-8')))
# Wait for Vault to confirm.
if (r.status_code != 200):