diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-05-09 21:14:12 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-05-09 21:14:12 -0300 |
commit | 8859fe9a251df7345080a02bcccf4c8250c9b504 (patch) | |
tree | f24e71260773170ecb257c1db74e8b70f6af563c | |
parent | 3ca758f3b3576067b0465c8a68422cb1bf172aea (diff) | |
download | renpy-8859fe9a251df7345080a02bcccf4c8250c9b504.tar.gz renpy-8859fe9a251df7345080a02bcccf4c8250c9b504.tar.bz2 renpy-8859fe9a251df7345080a02bcccf4c8250c9b504.tar.xz renpy-8859fe9a251df7345080a02bcccf4c8250c9b504.zip |
Sketch roughly how Vault authentication is currently done.
Some cleanup and it possibly can be finished later :3
-rw-r--r-- | game/update.rpy | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/game/update.rpy b/game/update.rpy index efc3710..bd702a5 100644 --- a/game/update.rpy +++ b/game/update.rpy @@ -288,16 +288,60 @@ screen register_input(prompt): id "input" copypaste True +screen notice(prompt): + ## Ensure other screens do not get input while this screen is displayed. + modal True + zorder 200 + style_prefix "confirm" + add "gui/overlay/confirm.png" + frame: + vbox: + xalign .5 + yalign .5 + spacing 30 + label _(prompt): + style "confirm_prompt" + xalign 0.5 + hbox: + xalign 0.5 + spacing 100 + textbutton _("OK") action Return() + label register: $ status_update(" ", 80) call screen register_method $ status_update(pc=85) $ method = _return - call screen register_input("Are you sure [method]? Type \"YES\".") + call screen register_input("Please insert your {b}email{/b}.") + $ email=_return $ status_update(pc=90) - $ answer = _return - $ stdout(answer) + + ########################################## + ## What we'll do now depends on the method + if method == 1: + ## Email-Auth (the default) + $ user = { + "email": email, + "confirmed": True + } + $ r = vault.put(VAULT_URL+"/vault/session", json=user) + # Wait for Vault to send you an email + if (r.status_code != 200): + call screen notice(_("Vault returned error %d\n\nPlease try again later." % r.status_code)) + return + call screen notice(_("An email was sent with your API token.\n\nYou'll need it shortly, so check your email.") + call screen register_input("Please insert the {b}token{/b} you received on your email.") + $ token = _return + $ user["key"] = token + #$ r = vault.get(VAULT_URL+"/vault/session?token=%s&email=%s" % (token, email)) # FIXME: HTTP formating for email + # FIXME: Continue from here + call screen notice(_("{b}INTERNAL SERVER ERROR{/b}\n\nSeems like someone messed up on the APIs!\nThis login method seems to be temporaly unavailable, please choose another one.") + elif method == 2: + ## 2FA-Auth + + ############ + ## Cleanup $ del method - $ del answer + $ del email return |