Merge pull request #2507 from boehlke/master

password change command
This commit is contained in:
Emanuel Schütze 2016-10-14 16:41:22 +02:00 committed by GitHub
commit c2a1675e37
1 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,25 @@
from django.core.management.base import BaseCommand
from openslides.users.models import User
class Command(BaseCommand):
"""
Command to change a user's password.
"""
help = 'Changes user password.'
def add_arguments(self, parser):
parser.add_argument(
'username',
help='The name of the user to set the password for'
)
parser.add_argument(
'password',
help='The new password of the user'
)
def handle(self, *args, **options):
user = User.objects.get(username=options['username'])
user.set_password(options['password'])
user.save()