mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-24 06:51:29 +01:00
Use secrets library to generate tokens
This commit is contained in:
parent
e9161610c4
commit
9dfb95a524
@ -13,8 +13,8 @@
|
|||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
import random
|
|
||||||
import string
|
import secrets
|
||||||
|
|
||||||
from .flask import *
|
from .flask import *
|
||||||
from .models import *
|
from .models import *
|
||||||
@ -45,5 +45,4 @@ def shouldReturnJson():
|
|||||||
|
|
||||||
|
|
||||||
def randomString(n):
|
def randomString(n):
|
||||||
return ''.join(random.choice(string.ascii_lowercase + \
|
return secrets.token_hex(int(n / 2))
|
||||||
string.ascii_uppercase + string.digits) for _ in range(n))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user