diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-07-28 20:37:55 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-07-28 20:37:55 -0300 |
commit | 5333221ff7b4197cf1aca20d74bb1cc04e686aab (patch) | |
tree | 85136f7ea17105071ac01dc1f01d10ce88acc4f6 /player.py | |
parent | 1dbbecb50b78cdd8bbd4b71c74beb36abde3d6c0 (diff) | |
download | server-5333221ff7b4197cf1aca20d74bb1cc04e686aab.tar.gz server-5333221ff7b4197cf1aca20d74bb1cc04e686aab.tar.bz2 server-5333221ff7b4197cf1aca20d74bb1cc04e686aab.tar.xz server-5333221ff7b4197cf1aca20d74bb1cc04e686aab.zip |
"Mail" can now be blank, it'll then use MyUID.
If a valid email is provided in a registration but MyUID is repeated,
it'll take over the account instead.
Diffstat (limited to 'player.py')
-rw-r--r-- | player.py | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -816,9 +816,14 @@ def register(args, token): y=json.loads(args) tmp=y["email"] mail=str(tmp) + tmp=y["MyUID"] + leni=len(tmp) + MyUID=str(y["MyUID"]) # Check if email is valid with above regex if not re.search(regex,mail): - raise Exception("Not a valid email") + if leni != 32 or mail != "": + raise Exception("Not a valid email") + mail="_%s@spheres.tmw2.org" % (MyUID) except: return ERR_BAD @@ -832,6 +837,13 @@ def register(args, token): stdout("WARNING: Tried to register email \"%s\" (belongs to account %s)" % (mail, check)) return ERR_BAD + # If email is an UID mail, clobber it + check=sql.query_email("_%s@spheres.tmw2.org" % (MyUID)) + if (check != ""): + passwd=clobber_email(check, "_%s@spheres.tmw2.org" % (MyUID), mail) + stdout("INFO: Set a new email for \"%s\" (%s)" % (check, mail)) + return compress({"userid": userid, "password": passwd}) + stdout("Now registering account") # Register it data=sql.add_player(mail) |