Loading deleted-email 0 → 100644 +13 −0 Original line number Diff line number Diff line Hi {$realname}, Your Swansea University Computer Society account ({$username}) has been deleted. Thank you for being a member! We hope you enjoyed your time within the society and consider rejoining at some point. -- Sent by {$adminname} Swansea University Computer Society https://sucs.org/ deleted-notify-email 0 → 100644 +5 −0 Original line number Diff line number Diff line {$adminname} has deleted {$username}'s account. -- The SUCS Account Manager https://projects.sucs.org/sucs/accountmanager No newline at end of file sucsam.py +61 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,55 @@ def listUsers(): for hon in hons: print(str(hon[0]) + " (" + str(hon[1]) + ")") def emailDeletedUser(userDBinfo): username = userDBdata[0][1] realname = userDBdata[0][2] email = userDBdata[0][3] adminname = pwd.getpwuid(os.geteuid())[0] file = codecs.open("deleted-email", encoding='utf-8') data = file.read() file.close() data = data.replace("{$realname}",realname) data = data.replace("{$username}",username) data = data.replace("{$adminname}",adminname) sender = 'staff@sucs.org' receiver = email message = MIMEMultipart() message['From'] = sender message['To'] = receiver message['Subject'] = 'Your SUCS account has been deleted' messageBody = MIMEText(data, 'plain', "UTF-8") message.attach(messageBody) smtpConn = smtplib.SMTP('localhost') smtpConn.sendmail(sender, receiver, message.as_string()) smtpConn.quit() def emailAdminDeleteUser(username): adminname = pwd.getpwuid(os.geteuid())[0] file = codecs.open("deleted-notify-email", encoding='utf-8') data = file.read() file.close() data = data.replace("{$username}",username) data = data.replace("{$adminname}",adminname) sender = 'staff@sucs.org' receiver = email message = MIMEMultipart() message['From'] = sender message['To'] = "logs@sucs.org" message['Subject'] = username +''s SUCS account has been deleted' messageBody = MIMEText(data, 'plain', "UTF-8") message.attach(messageBody) smtpConn = smtplib.SMTP('localhost') smtpConn.sendmail(sender, receiver, message.as_string()) smtpConn.quit() def deleteUser(peopleList): #get fs ready Loading Loading @@ -238,6 +287,18 @@ def deleteUser(peopleList): DBconn.commit() cur.close() #notify people #them emailDeletedUser(userDBinfo) #logs@ emailAdminDeleteUser(person[0]) #remove the entry from the list peoplelist.remove(person) #return to the deletemenu with an empty list as we've just deleted everyone deleteMenu(peoplelist) def reminderMenu(): print("") Loading Loading
deleted-email 0 → 100644 +13 −0 Original line number Diff line number Diff line Hi {$realname}, Your Swansea University Computer Society account ({$username}) has been deleted. Thank you for being a member! We hope you enjoyed your time within the society and consider rejoining at some point. -- Sent by {$adminname} Swansea University Computer Society https://sucs.org/
deleted-notify-email 0 → 100644 +5 −0 Original line number Diff line number Diff line {$adminname} has deleted {$username}'s account. -- The SUCS Account Manager https://projects.sucs.org/sucs/accountmanager No newline at end of file
sucsam.py +61 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,55 @@ def listUsers(): for hon in hons: print(str(hon[0]) + " (" + str(hon[1]) + ")") def emailDeletedUser(userDBinfo): username = userDBdata[0][1] realname = userDBdata[0][2] email = userDBdata[0][3] adminname = pwd.getpwuid(os.geteuid())[0] file = codecs.open("deleted-email", encoding='utf-8') data = file.read() file.close() data = data.replace("{$realname}",realname) data = data.replace("{$username}",username) data = data.replace("{$adminname}",adminname) sender = 'staff@sucs.org' receiver = email message = MIMEMultipart() message['From'] = sender message['To'] = receiver message['Subject'] = 'Your SUCS account has been deleted' messageBody = MIMEText(data, 'plain', "UTF-8") message.attach(messageBody) smtpConn = smtplib.SMTP('localhost') smtpConn.sendmail(sender, receiver, message.as_string()) smtpConn.quit() def emailAdminDeleteUser(username): adminname = pwd.getpwuid(os.geteuid())[0] file = codecs.open("deleted-notify-email", encoding='utf-8') data = file.read() file.close() data = data.replace("{$username}",username) data = data.replace("{$adminname}",adminname) sender = 'staff@sucs.org' receiver = email message = MIMEMultipart() message['From'] = sender message['To'] = "logs@sucs.org" message['Subject'] = username +''s SUCS account has been deleted' messageBody = MIMEText(data, 'plain', "UTF-8") message.attach(messageBody) smtpConn = smtplib.SMTP('localhost') smtpConn.sendmail(sender, receiver, message.as_string()) smtpConn.quit() def deleteUser(peopleList): #get fs ready Loading Loading @@ -238,6 +287,18 @@ def deleteUser(peopleList): DBconn.commit() cur.close() #notify people #them emailDeletedUser(userDBinfo) #logs@ emailAdminDeleteUser(person[0]) #remove the entry from the list peoplelist.remove(person) #return to the deletemenu with an empty list as we've just deleted everyone deleteMenu(peoplelist) def reminderMenu(): print("") Loading