mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-12 16:26:12 +01:00
further refoctor default render mailserver
This commit is contained in:
@@ -6,8 +6,6 @@ from pathlib import Path
|
||||
from random import randint
|
||||
|
||||
from django.shortcuts import HttpResponse, redirect
|
||||
from django.shortcuts import render
|
||||
|
||||
from loginSystem.models import Administrator
|
||||
from loginSystem.views import loadLoginPage
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
|
||||
@@ -58,16 +58,12 @@ class MailServerManager(multi.Thread):
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + ' [MailServerManager.run]')
|
||||
|
||||
def loadEmailHome(self):
|
||||
try:
|
||||
proc = httpProc(self.request, 'mailServer/index.html',
|
||||
None, 'createEmail')
|
||||
return proc.render()
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def createEmailAccount(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
@@ -83,11 +79,7 @@ class MailServerManager(multi.Thread):
|
||||
{'websiteList': websitesName, "status": 1}, 'createEmail')
|
||||
return proc.render()
|
||||
|
||||
except BaseException as msg:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def listEmails(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
@@ -103,9 +95,6 @@ class MailServerManager(multi.Thread):
|
||||
{'websiteList': websitesName, "status": 1}, 'listEmails')
|
||||
return proc.render()
|
||||
|
||||
except BaseException as msg:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitEmailCreation(self):
|
||||
try:
|
||||
|
||||
@@ -148,12 +137,9 @@ class MailServerManager(multi.Thread):
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def deleteEmailAccount(self):
|
||||
try:
|
||||
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/postfix'):
|
||||
proc = httpProc(self.request, 'mailServer/deleteEmailAccount.html',
|
||||
{"status": 0}, 'deleteEmail')
|
||||
@@ -166,9 +152,6 @@ class MailServerManager(multi.Thread):
|
||||
{'websiteList': websitesName, "status": 1}, 'deleteEmail')
|
||||
return proc.render()
|
||||
|
||||
except BaseException as msg:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def getEmailsForDomain(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
@@ -292,7 +275,6 @@ class MailServerManager(multi.Thread):
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def emailForwarding(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
@@ -307,8 +289,6 @@ class MailServerManager(multi.Thread):
|
||||
proc = httpProc(self.request, 'mailServer/emailForwarding.html',
|
||||
{'websiteList': websitesName, "status": 1}, 'emailForwarding')
|
||||
return proc.render()
|
||||
except BaseException as msg:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def fetchCurrentForwardings(self):
|
||||
try:
|
||||
@@ -582,13 +562,9 @@ class MailServerManager(multi.Thread):
|
||||
#######
|
||||
|
||||
def changeEmailAccountPassword(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if ACLManager.currentContextPermission(currentACL, 'changeEmailPassword') == 0:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if not os.path.exists('/home/cyberpanel/postfix'):
|
||||
proc = httpProc(self.request, 'mailServer/changeEmailPassword.html',
|
||||
{"status": 0}, 'changeEmailPassword')
|
||||
@@ -600,8 +576,6 @@ class MailServerManager(multi.Thread):
|
||||
proc = httpProc(self.request, 'mailServer/changeEmailPassword.html',
|
||||
{'websiteList': websitesName, "status": 1}, 'changeEmailPassword')
|
||||
return proc.render()
|
||||
except BaseException as msg:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def submitPasswordChange(self):
|
||||
try:
|
||||
@@ -653,13 +627,9 @@ class MailServerManager(multi.Thread):
|
||||
#######
|
||||
|
||||
def dkimManager(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if ACLManager.currentContextPermission(currentACL, 'dkimManager') == 0:
|
||||
return ACLManager.loadError()
|
||||
|
||||
openDKIMInstalled = 1
|
||||
|
||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||
@@ -669,9 +639,6 @@ class MailServerManager(multi.Thread):
|
||||
{'websiteList': websitesName, 'openDKIMInstalled': openDKIMInstalled}, 'dkimManager')
|
||||
return proc.render()
|
||||
|
||||
except BaseException as msg:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def fetchDKIMKeys(self):
|
||||
try:
|
||||
userID = self.request.session['userID']
|
||||
|
||||
Reference in New Issue
Block a user