use base58 for slugs to remove doubt
This commit is contained in:
parent
426357f00d
commit
978b432d7e
1 changed files with 4 additions and 2 deletions
|
@ -11,9 +11,11 @@ from utils import first
|
|||
from .database import db
|
||||
from .user import User
|
||||
|
||||
BASE58_ALPHABET = \
|
||||
b'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
||||
|
||||
def generate_slug():
|
||||
alphabet = string.ascii_letters + string.digits
|
||||
secret = ''.join(secrets.choice(alphabet) for i in range(7))
|
||||
secret = ''.join(secrets.choice(BASE58_ALPHABET) for i in range(7))
|
||||
while Order.query.filter(Order.slug == secret).first() is not None:
|
||||
secret = ''.join(secrets.choice(alphabet) for i in range(7))
|
||||
return secret
|
||||
|
|
Loading…
Reference in a new issue