This commit is contained in:
2023-11-16 13:17:59 +01:00
parent e6c8abe026
commit a16cb64606
4 changed files with 95 additions and 7 deletions
+9
View File
@@ -2,6 +2,8 @@
import sqlite3
import re
from onetimepass import valid_totp
from secrets import choice
class Tools():
@@ -43,4 +45,11 @@ class Tools():
regex = r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!#%*?&]{8,18}$'
return(bool(re.fullmatch(regex, e)))
def generate_secret(self): # Function to return a random string with length 16.
secret = ''
while len(secret) < 16:
secret += choice('ABCDEFGHIJKLMNOPQRSTUVWXYZ234567')
return secret
tools = Tools()