From ef24d4fb42a4851dd3f554bfcdcc1ca642d0642e Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Thu, 16 Jul 2020 12:49:08 +0500 Subject: [PATCH] add remote access dialog box --- databases/static/databases/databases.js | 52 +++++++++++++++++++ .../templates/databases/listDataBases.html | 42 +-------------- 2 files changed, 54 insertions(+), 40 deletions(-) diff --git a/databases/static/databases/databases.js b/databases/static/databases/databases.js index d1e91175b..f4a650ec7 100755 --- a/databases/static/databases/databases.js +++ b/databases/static/databases/databases.js @@ -454,6 +454,58 @@ app.controller('listDBs', function ($scope, $http) { $scope.generatedPasswordView = true; }; + $scope.remoteAccess = function () { + + $scope.dbLoading = false; + $scope.passwordChanged = true; + + + url = "/dataBases/changePassword"; + + var data = { + dbUserName: globalDBUsername, + dbPassword: $scope.dbPassword, + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + + + if (response.data.changePasswordStatus == 1) { + $scope.notificationsBox = false; + $scope.passwordChanged = false; + $scope.dbLoading = true; + $scope.domainFeteched = $scope.selectedDomain; + + } + else { + $scope.notificationsBox = false; + $scope.canNotChangePassword = false; + $scope.dbLoading = true; + $scope.canNotChangePassword = false; + $scope.errorMessage = response.data.error_message; + } + + } + + function cantLoadInitialDatas(response) { + $scope.notificationsBox = false; + $scope.couldNotConnect = false; + $scope.dbLoading = true; + + } + + }; + }); diff --git a/databases/templates/databases/listDataBases.html b/databases/templates/databases/listDataBases.html index d11521865..8f663a74a 100755 --- a/databases/templates/databases/listDataBases.html +++ b/databases/templates/databases/listDataBases.html @@ -130,30 +130,13 @@ -