Rework invitation system and add qrcode
This commit is contained in:
@@ -43,11 +43,24 @@ def valid_username(username):
|
||||
valid=True
|
||||
# Caractères non autorisés dans la RFC #822
|
||||
invalid_char = { '(', ')', '<', '>', ',', ';', ':', '"', '[', ']', '|', 'ç', '%', '&', ' ' }
|
||||
|
||||
|
||||
for character in invalid_char:
|
||||
if character in username:
|
||||
valid=False
|
||||
|
||||
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
||||
cursor = conn.cursor() # Création de l'objet "curseur"
|
||||
|
||||
cursor.execute("""SELECT name FROM users WHERE name=?""", (username,))
|
||||
tmp = cursor.fetchone()
|
||||
conn.close()
|
||||
|
||||
if tmp:
|
||||
valid = True
|
||||
else:
|
||||
valid = False
|
||||
|
||||
|
||||
return valid
|
||||
|
||||
def set_mail_domain():
|
||||
@@ -109,7 +122,7 @@ def valid_token_register(token, token_type):
|
||||
cursor.execute("""SELECT name FROM users where token=?""", (token,))
|
||||
tmp = cursor.fetchone()
|
||||
conn.close()
|
||||
print (tmp)
|
||||
|
||||
if tmp:
|
||||
valid = True
|
||||
else:
|
||||
@@ -121,7 +134,6 @@ def valid_token_register(token, token_type):
|
||||
|
||||
def get_user_by_token(token, token_type):
|
||||
|
||||
|
||||
if len(token) != 30 and len(token) != 64:
|
||||
user = "Invalid Token"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user