mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Use token_hex from secrets instead of choice
CURA-8401
This commit is contained in:
parent
e24a844d17
commit
8b5cfc9c28
1 changed files with 2 additions and 2 deletions
|
|
@ -139,11 +139,11 @@ class AuthorizationHelpers:
|
||||||
def generateVerificationCode(code_length: int = 32) -> str:
|
def generateVerificationCode(code_length: int = 32) -> str:
|
||||||
"""Generate a verification code of arbitrary length.
|
"""Generate a verification code of arbitrary length.
|
||||||
|
|
||||||
:param code_length:: How long should the code be? This should never be lower than 16, but it's probably
|
:param code_length:: How long should the code be in bytes? This should never be lower than 16, but it's probably
|
||||||
better to leave it at 32
|
better to leave it at 32
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return "".join(secrets.choice("0123456789ABCDEF") for i in range(code_length))
|
return secrets.token_hex(code_length)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generateVerificationCodeChallenge(verification_code: str) -> str:
|
def generateVerificationCodeChallenge(verification_code: str) -> str:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue