2fa-0.5
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user