Skip to content

Commit

Permalink
bug fix: improve size for smtphost
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Sep 15, 2020
1 parent 6e076aa commit 9352936
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
24 changes: 21 additions & 3 deletions cloudAPI/cloudManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,42 @@ def submitWebsiteCreation(self):
try:

try:
selectedACL = ACL.objects.get(name='user')

UserAccountName = self.data['UserAccountName']
UserPassword = self.data['UserPassword']
FullName = self.data['FullName']
token = hashPassword.generateToken(UserAccountName, UserPassword)
password = hashPassword.hash_password(UserPassword)

try:
initWebsitesLimit = int(self.data['websitesLimit'])
except:
initWebsitesLimit = 10

try:
acl = self.data['acl']
selectedACL = ACL.objects.get(name=acl)

except:
selectedACL = ACL.objects.get(name='user')

try:
apiAccess = int(self.data['api'])
except:
apiAccess = 10

try:
newAdmin = Administrator(firstName=FullName,
lastName="",
email=self.data['adminEmail'],
type=3,
userName=UserAccountName,
password=password,
initWebsitesLimit=10,
initWebsitesLimit=initWebsitesLimit,
owner=1,
acl=selectedACL,
token=token
token=token,
api=apiAccess
)
newAdmin.save()
except BaseException as msg:
Expand Down
4 changes: 2 additions & 2 deletions emailMarketing/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class SMTPHosts(models.Model):
owner = models.ForeignKey(Administrator, on_delete=models.CASCADE)
host = models.CharField(max_length=150, unique= True)
port = models.CharField(max_length=10)
userName = models.CharField(max_length=50)
password = models.CharField(max_length=50)
userName = models.CharField(max_length=200)
password = models.CharField(max_length=200)

class EmailTemplate(models.Model):
owner = models.ForeignKey(Administrator, on_delete=models.CASCADE)
Expand Down
10 changes: 10 additions & 0 deletions plogical/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,16 @@ def applyLoginSystemMigrations():
except:
pass

try:

This comment has been minimized.

Copy link
@usmannasir

usmannasir Sep 15, 2020

Author Owner
cursor.execute("ALTER TABLE emailMarketing_smtphosts MODIFY userName varchar(200)")
except:
pass

try:
cursor.execute("ALTER TABLE emailMarketing_smtphosts MODIFY password varchar(200)")
except:
pass

try:
cursor.execute("ALTER TABLE websiteFunctions_backups MODIFY fileName varchar(200)")
except:
Expand Down
19 changes: 19 additions & 0 deletions userManagment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,31 @@ def submitUserDeletion(request):

accountUsername = data['accountUsername']

try:
force = data['force']
except:
force = 0


currentACL = ACLManager.loadedACL(userID)

currentUser = Administrator.objects.get(pk=userID)
userInQuestion = Administrator.objects.get(userName=accountUsername)


if ACLManager.checkUserOwnerShip(currentACL, currentUser, userInQuestion):


if force:
userACL = ACLManager.loadedACL(userInQuestion.pk)
websitesName = ACLManager.findAllSites(userACL, userInQuestion.pk)

from websiteFunctions.website import WebsiteManager
wm = WebsiteManager()

for website in websitesName:
wm.submitWebsiteDeletion(userID, {'websiteName': website})

user = Administrator.objects.get(userName=accountUsername)

childUsers = Administrator.objects.filter(owner=user.pk)
Expand Down

0 comments on commit 9352936

Please sign in to comment.