From 3af8642ff0193aabe6678e5d5e3d10faf56fca6e Mon Sep 17 00:00:00 2001 From: Etzelia Date: Mon, 30 Sep 2019 21:43:13 +0200 Subject: [PATCH] Allow mods to re-register/reset their password (#37) --- api/views.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/views.py b/api/views.py index 47cd31f..ac73209 100644 --- a/api/views.py +++ b/api/views.py @@ -279,11 +279,13 @@ class PluginAPI(View): json['message'] = "Updated {0}".format(post['username']) elif "register" == keyword: player = Player.objects.get(uuid=post['uuid']) + password = mcm_api.generate_password() if player.auth_user: - json['status'] = False - json['message'] = "You are already registered. To change your password, contact an Admin." + player.auth_user.password = password + player.auth_user.is_active = True + player.auth_user.save() + json['message'] = password else: - password = mcm_api.generate_password() user = User.objects.create_user(username=player.username.lower(), password=password) user.save() player.auth_user = user