bepasty: Minor fixes

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Sunil Mohan Adapa 2020-08-18 20:02:23 -07:00 committed by Joseph Nuthalapati
parent 6eed0484ab
commit e03b6041d4
No known key found for this signature in database
GPG Key ID: 5398F00A2FA43C35
3 changed files with 7 additions and 6 deletions

View File

@ -87,7 +87,7 @@ def subcommand_setup(arguments):
except KeyError:
subprocess.run(['addgroup', '--system', 'bepasty'], check=True)
# Create bepasty user is needed.
# Create bepasty user if needed.
try:
pwd.getpwnam('bepasty')
except KeyError:
@ -226,15 +226,15 @@ def subcommand_set_default(arguments):
def _format_permissions(permissions=None):
"""Format permissions as comma-separated"""
"""Format permissions as comma-separated."""
return ','.join(set(bepasty.PERMISSIONS.keys()).intersection(
permissions)) if permissions else ''
def _generate_password():
"""Generate a random password"""
"""Generate a random password."""
alphabet = string.ascii_letters + string.digits
return ''.join(secrets.choice(alphabet) for i in range(PASSWORD_LENGTH))
return ''.join(secrets.choice(alphabet) for _ in range(PASSWORD_LENGTH))
def main():

View File

@ -132,6 +132,6 @@ def get_default_permissions():
def set_default_permissions(permissions):
"""Set default permissions"""
"""Set default permissions."""
perm = permissions.split()
actions.superuser_run('bepasty', ['set-default', '--permissions'] + perm)

View File

@ -22,7 +22,8 @@
{% if not passwords %}
<p>{% trans 'No passwords currently configured.' %}</p>
{% else %}
<table class="table table-bordered table-condensed table-striped" id="passwords-list">
<table class="table table-bordered table-condensed table-striped"
id="passwords-list">
<thead>
<tr>
<th>{% trans "Password" %}</th>