mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
Feature: allow user to disable session ip check
This commit is contained in:
@@ -42,7 +42,8 @@ app.controller('createUserCtr', function ($scope, $http) {
|
||||
selectedACL: selectedACL,
|
||||
websitesLimit: websitesLimits,
|
||||
userName: userName,
|
||||
password: password
|
||||
password: password,
|
||||
securityLevel: $scope.securityLevel
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -171,6 +172,7 @@ app.controller('modifyUser', function ($scope, $http) {
|
||||
$scope.firstName = userDetails.firstName;
|
||||
$scope.lastName = userDetails.lastName;
|
||||
$scope.email = userDetails.email;
|
||||
$scope.secLevel = userDetails.securityLevel;
|
||||
|
||||
$scope.userModificationLoading = true;
|
||||
$scope.acctDetailsFetched = false;
|
||||
@@ -181,6 +183,7 @@ app.controller('modifyUser', function ($scope, $http) {
|
||||
$scope.detailsFetched = false;
|
||||
$scope.userAccountsLimit = true;
|
||||
$scope.websitesLimit = true;
|
||||
|
||||
} else {
|
||||
$scope.userModificationLoading = true;
|
||||
$scope.acctDetailsFetched = true;
|
||||
@@ -248,7 +251,8 @@ app.controller('modifyUser', function ($scope, $http) {
|
||||
firstName: firstName,
|
||||
lastName: lastName,
|
||||
email: email,
|
||||
password: password
|
||||
password: password,
|
||||
securityLevel: $scope.securityLevel
|
||||
};
|
||||
|
||||
var config = {
|
||||
|
||||
@@ -102,6 +102,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="acctDetailsFetched" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Security Level" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="fetchUserDetails()" ng-model="securityLevel" class="form-control">
|
||||
<option>HIGH</option>
|
||||
<option>LOW</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
|
||||
@@ -81,6 +81,20 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="acctDetailsFetched" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Security Level" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="fetchUserDetails()" ng-model="securityLevel" class="form-control">
|
||||
<option>HIGH</option>
|
||||
<option>LOW</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
Currently: {$ secLevel $}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="acctDetailsFetched" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
|
||||
@@ -10,6 +10,7 @@ from plogical import hashPassword
|
||||
from plogical import CyberCPLogFileWriter as logging
|
||||
from plogical.acl import ACLManager
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from CyberCP.secMiddleware import secMiddleware
|
||||
|
||||
# Create your views here.
|
||||
|
||||
@@ -138,6 +139,7 @@ def submitUserCreation(request):
|
||||
password = data['password']
|
||||
websitesLimit = data['websitesLimit']
|
||||
selectedACL = data['selectedACL']
|
||||
securityLevel = data['securityLevel']
|
||||
|
||||
selectedACL = ACL.objects.get(name=selectedACL)
|
||||
|
||||
@@ -146,6 +148,11 @@ def submitUserCreation(request):
|
||||
else:
|
||||
type = 3
|
||||
|
||||
if securityLevel == 'LOW':
|
||||
securityLevel = secMiddleware.LOW
|
||||
else:
|
||||
securityLevel = secMiddleware.HIGH
|
||||
|
||||
token = hashPassword.generateToken(userName, password)
|
||||
password = hashPassword.hash_password(password)
|
||||
currentAdmin = Administrator.objects.get(pk=userID)
|
||||
@@ -168,7 +175,8 @@ def submitUserCreation(request):
|
||||
initWebsitesLimit=websitesLimit,
|
||||
owner=currentAdmin.pk,
|
||||
acl=selectedACL,
|
||||
token=token
|
||||
token=token,
|
||||
securityLevel=securityLevel,
|
||||
)
|
||||
newAdmin.save()
|
||||
|
||||
@@ -183,7 +191,8 @@ def submitUserCreation(request):
|
||||
initWebsitesLimit=websitesLimit,
|
||||
owner=currentAdmin.pk,
|
||||
acl=selectedACL,
|
||||
token=token
|
||||
token=token,
|
||||
securityLevel=securityLevel,
|
||||
)
|
||||
newAdmin.save()
|
||||
elif currentACL['createNewUser'] == 1:
|
||||
@@ -197,7 +206,8 @@ def submitUserCreation(request):
|
||||
initWebsitesLimit=websitesLimit,
|
||||
owner=currentAdmin.pk,
|
||||
acl=selectedACL,
|
||||
token=token
|
||||
token=token,
|
||||
securityLevel=securityLevel,
|
||||
)
|
||||
newAdmin.save()
|
||||
else:
|
||||
@@ -261,6 +271,12 @@ def fetchUserDetails(request):
|
||||
email = user.email
|
||||
|
||||
websitesLimit = user.initWebsitesLimit
|
||||
securityLevel = ''
|
||||
|
||||
if user.securityLevel == secMiddleware.LOW:
|
||||
securityLevel = 'Low'
|
||||
else:
|
||||
securityLevel = 'High'
|
||||
|
||||
userDetails = {
|
||||
"id": user.id,
|
||||
@@ -268,7 +284,8 @@ def fetchUserDetails(request):
|
||||
"lastName": lastName,
|
||||
"email": email,
|
||||
"acl": user.acl.name,
|
||||
"websitesLimit": websitesLimit
|
||||
"websitesLimit": websitesLimit,
|
||||
"securityLevel": securityLevel
|
||||
}
|
||||
|
||||
data_ret = {'fetchStatus': 1, 'error_message': 'None', "userDetails": userDetails}
|
||||
@@ -296,6 +313,7 @@ def saveModifications(request):
|
||||
firstName = data['firstName']
|
||||
lastName = data['lastName']
|
||||
email = data['email']
|
||||
securityLevel = data['securityLevel']
|
||||
|
||||
user = Administrator.objects.get(userName=accountUsername)
|
||||
|
||||
@@ -323,6 +341,11 @@ def saveModifications(request):
|
||||
user.token = token
|
||||
user.type = 0
|
||||
|
||||
if securityLevel == 'LOW':
|
||||
user.securityLevel = secMiddleware.LOW
|
||||
else:
|
||||
user.securityLevel = secMiddleware.HIGH
|
||||
|
||||
user.save()
|
||||
|
||||
data_ret = {'status': 1, 'saveStatus': 1, 'error_message': 'None'}
|
||||
|
||||
Reference in New Issue
Block a user