mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
nextcloud: Use secrets module generate passwords
- It choose highest security random number automatically. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
547db1608b
commit
d7b05385c6
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import pathlib
|
import pathlib
|
||||||
import random
|
import secrets
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -304,8 +304,7 @@ def _drop_database():
|
|||||||
def _generate_secret_key(length=64, chars=None):
|
def _generate_secret_key(length=64, chars=None):
|
||||||
"""Generate a new random secret key for use with Nextcloud."""
|
"""Generate a new random secret key for use with Nextcloud."""
|
||||||
chars = chars or (string.ascii_letters + string.digits)
|
chars = chars or (string.ascii_letters + string.digits)
|
||||||
rand = random.SystemRandom()
|
return ''.join(secrets.choice(chars) for _ in range(length))
|
||||||
return ''.join(rand.choice(chars) for _ in range(length))
|
|
||||||
|
|
||||||
|
|
||||||
def _set_maintenance_mode(on: bool):
|
def _set_maintenance_mode(on: bool):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user