Fix bugs in mailsection

This commit is contained in:
Charlie Root
2025-12-21 18:38:46 +01:00
parent c2068c1d45
commit 0ef6950a69
2 changed files with 10 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ MAIL_SERVER = app.config['MAIL_SERVER']
XMPP_SERVER = app.config['XMPP_SERVER']
SETUID = app.config['SETUID']
BASE_URL = app.config['BASE_URL']
MAIL_DOMAIN = app.config['HOST']
MAIL_DOMAIN = app.config['MAIL_DOMAIN']
MAIL_WEBSERVICE = app.config['MAIL_WEBSERVICE']
XMPP_WEBSERVICE = app.config['XMPP_WEBSERVICE']
@@ -55,6 +55,8 @@ def mymessaging():
section="mymessaging",
hostname=hostname,
myemail=myemail,
imap_address=app.config['IMAP_ADDRESS'],
smtp_address=app.config['SMTP_ADDRESS'],
mail_server=MAIL_SERVER,
mail_webservice=MAIL_WEBSERVICE,
xmpp_server=XMPP_SERVER,
@@ -90,11 +92,11 @@ def myalias():
cursor.execute("UPDATE users SET alias=? WHERE name=?",
(aliases, user))
conn.commit()
time=time.strftime("%A %d %B %Y %H:%M:%S")
time_create_alias = time.strftime("%A %d %B %Y %H:%M:%S")
ip_address=request.environ['REMOTE_ADDR']
client_plateform=request.headers.get('User-Agent')
log=time + ' - ' + ip_address + ' - ' + user + ' - ' + client_platerform + '\n' + '---> ' + "Ajout de l'alias "+ alias + '\n'
log=time_create_alias + ' - ' + ip_address + ' - ' + user + ' - ' + client_plateform + '\n' + '---> ' + "Ajout de l'alias "+ alias + '\n'
append_to_log(log, user)
flash(u'Votre alias a été ajouté', 'succes')
else:
@@ -147,14 +149,14 @@ def remove_alias(aliasrm):
cursor.execute("UPDATE users SET alias=? WHERE name=?",
(aliases, user))
conn.commit()
time=time.strftime("%A %d %B %Y %H:%M:%S")
time_del_alias=time.strftime("%A %d %B %Y %H:%M:%S")
ip_address=request.environ['REMOTE_ADDR']
client_platform=request.headers.get('User-Agent')
log = time + ' - ' + ip_address + ' - ' + user + ' - ' + client_platform + '\n' + '---> ' + "Suppression de l'alias "+ alias + '\n'
log = time_del_alias + ' - ' + ip_address + ' - ' + user + ' - ' + client_platform + '\n' + '---> ' + "Suppression de l'alias "+ alias + '\n'
append_to_log(log, user)
flash(u'Votre alias a été supprimé', 'succes')
else:
flash(u'Il y a eu une erreur', 'error')
return redirect(url_for('mymailbox.myalias', _external=True))
return redirect(url_for('mymailbox.myalias'))