bepasty: Require at least one permission on a password

- Since a password without any permissions is not useful.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
Sunil Mohan Adapa authored and Joseph Nuthalapati committed 2020-08-21 22:42:30 +05:30
1 parent 8194628eb3
commit 028137a4e4
3 files changed
+7 -10

No files matched your search

+3 -6
View File
@@ -106,12 +106,9 @@ def list_passwords():
return json.loads(output)
def add_password(permissions=None, comment=None):
"""Generate a password with given permissions"""
command = ['add-password']
if permissions:
command += ['--permissions'] + permissions
def add_password(permissions, comment=None):
"""Generate a password with given permissions."""
command = ['add-password', '--permissions'] + permissions
if comment:
command += ['--comment', comment]
+2 -2
View File
@@ -24,8 +24,8 @@ class AddPasswordForm(forms.Form):
permissions = forms.MultipleChoiceField(
choices=bepasty.PERMISSIONS.items(),
widget=forms.CheckboxSelectMultiple, required=False,
label=_('Permissions'), help_text=_(
widget=forms.CheckboxSelectMultiple, label=_('Permissions'),
help_text=_(
'Users that log in with this password will have the selected '
'permissions.'))