From 51cc1b4f2439acf1511e852625c6834133d9e25f Mon Sep 17 00:00:00 2001 From: "usman@cyberpersons.com" Date: Mon, 27 Feb 2023 10:11:32 +0500 Subject: [PATCH] ChangeLinuxUserPassword --- cloudAPI/views.py | 4 ++++ websiteFunctions/website.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cloudAPI/views.py b/cloudAPI/views.py index fbfb9e185..254f0e75f 100755 --- a/cloudAPI/views.py +++ b/cloudAPI/views.py @@ -118,6 +118,10 @@ def router(request): return cm.ChangeStateThemes() elif controller == 'DeleteThemes': return cm.DeleteThemes() + elif controller == 'ChangeLinuxUserPassword': + from websiteFunctions.website import WebsiteManager + wm = WebsiteManager() + return wm.saveSSHAccessChanges(admin.id, data) elif controller == 'GetServerPublicSSHkey': return cm.GetServerPublicSSHkey() elif controller == 'SubmitPublicKey': diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index d2363e177..63684f988 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -4680,13 +4680,13 @@ StrictHostKeyChecking no uBuntuPath = '/etc/lsb-release' if os.path.exists(uBuntuPath): - command = "echo '%s:%s' | chpasswd" % (data['externalApp'], data['password']) + command = "echo '%s:%s' | chpasswd" % (website.externalApp, data['password']) else: - command = 'echo "%s" | passwd --stdin %s' % (data['password'], data['externalApp']) + command = 'echo "%s" | passwd --stdin %s' % (data['password'], website.externalApp) ProcessUtilities.executioner(command) - data_ret = {'status': 1, 'error_message': 'None'} + data_ret = {'status': 1, 'error_message': 'None', 'LinuxUser': website.externalApp} json_data = json.dumps(data_ret) return HttpResponse(json_data)