2023-11-02 08:03:21 +01:00
|
|
|
from flask import Blueprint, Flask, request, flash, render_template, url_for, session, redirect, abort, make_response, send_file, flash, abort, send_from_directory
|
2022-07-05 01:18:52 +02:00
|
|
|
from werkzeug.utils import secure_filename
|
2022-07-06 16:47:55 +02:00
|
|
|
from PIL import Image
|
2023-11-02 08:03:21 +01:00
|
|
|
from markupsafe import escape
|
2020-11-29 02:05:19 +01:00
|
|
|
import time
|
|
|
|
import sqlite3
|
|
|
|
import os
|
2022-08-06 18:22:24 +02:00
|
|
|
from socket import gethostname
|
|
|
|
from flask_bcrypt import Bcrypt
|
2022-09-01 07:29:49 +02:00
|
|
|
from tools.utils import email_disp, append_to_log, gen_token, valid_passwd
|
2020-11-29 02:05:19 +01:00
|
|
|
|
|
|
|
profil = Blueprint('profil', __name__, template_folder='templates')
|
|
|
|
|
2022-07-11 00:36:31 +02:00
|
|
|
app = Flask( 'pywallter' )
|
|
|
|
app.config.from_pyfile('config.py')
|
|
|
|
|
|
|
|
|
|
|
|
#### Variables ####################################################################################
|
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
bcrypt = Bcrypt(app)
|
|
|
|
DOSSIER_PERSO = app.config['DOSSIER_APP']
|
2022-07-11 00:36:31 +02:00
|
|
|
|
|
|
|
extensionimg = app.config['EXT_IMG']
|
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
DATABASE = app.config['DATABASE']
|
2023-07-06 05:07:34 +02:00
|
|
|
DATAS_USER = app.config['DOSSIER_APP']
|
2022-08-06 18:22:24 +02:00
|
|
|
MAIL_SERVER = app.config['MAIL_SERVER']
|
|
|
|
XMPP_SERVER = app.config['XMPP_SERVER']
|
|
|
|
SETUID = app.config['SETUID']
|
2022-08-06 23:49:16 +02:00
|
|
|
BASE_URL = app.config['BASE_URL']
|
2023-07-06 05:07:34 +02:00
|
|
|
BACKUP_TIME = app.config['BACKUP_TIME']
|
2022-08-06 23:49:16 +02:00
|
|
|
|
2022-07-11 00:36:31 +02:00
|
|
|
##################################################################################################
|
|
|
|
|
2020-11-29 02:05:19 +01:00
|
|
|
|
2022-08-07 08:32:21 +02:00
|
|
|
@profil.route( '/profil/<user>/<img>', methods=['GET'] )
|
|
|
|
def profil_img(user, img) :
|
2022-08-06 18:22:24 +02:00
|
|
|
if 'username' in session :
|
2022-08-07 08:32:21 +02:00
|
|
|
|
|
|
|
return send_from_directory( os.path.join(DOSSIER_PERSO, user, 'profile'), img )
|
2022-08-06 18:22:24 +02:00
|
|
|
else:
|
2022-08-07 07:32:42 +02:00
|
|
|
return redirect(BASE_URL, code=401)
|
2022-08-06 18:22:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-10 15:09:03 +02:00
|
|
|
@profil.route('/profil/', methods=['GET','POST'] )
|
|
|
|
def profile() :
|
2020-11-29 02:05:19 +01:00
|
|
|
if 'username' in session :
|
2022-07-10 15:09:03 +02:00
|
|
|
UTILISATEUR='%s' % escape(session['username'])
|
2022-08-06 18:22:24 +02:00
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
2022-07-10 15:09:03 +02:00
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
cursor.execute("""SELECT avatar, nom, prenom, age, mail_rescue FROM users WHERE name=?""", (UTILISATEUR,))
|
|
|
|
tmp = (cursor.fetchone())
|
|
|
|
profil_user = dict()
|
|
|
|
profil_user['avatar'] = tmp[0]
|
|
|
|
profil_user['nom'] = tmp[1]
|
|
|
|
profil_user['prenom'] = tmp[2]
|
|
|
|
profil_user['age'] = tmp[3]
|
|
|
|
profil_user['mail_rescue'] = tmp[4]
|
|
|
|
conn.close()
|
|
|
|
|
|
|
|
if request.method == 'POST' :
|
|
|
|
|
|
|
|
f = request.files['fic']
|
|
|
|
if request.form['nom']:
|
|
|
|
profil_user['nom'] = request.form['nom']
|
|
|
|
if request.form['prenom']:
|
|
|
|
profil_user['prenom'] = request.form['prenom']
|
|
|
|
if request.form['age']:
|
|
|
|
profil_user['age'] = request.form['age']
|
|
|
|
if '@' in request.form['mail_rescue']:
|
|
|
|
if len(request.form['mail_rescue']) > 4:
|
|
|
|
profil_user['mail_rescue'] = request.form['mail_rescue']
|
|
|
|
else:
|
|
|
|
flash(u'Adresse de courriel invalide', 'error')
|
|
|
|
else:
|
|
|
|
flash(u'Adresse de courriel invalide', 'error')
|
|
|
|
if f: # On vérifie qu'un fichier a bien été envoyé
|
|
|
|
nom = secure_filename(f.filename)
|
|
|
|
f.save(DOSSIER_PERSO + UTILISATEUR + '/profile/' + nom)
|
|
|
|
image = DOSSIER_PERSO + UTILISATEUR + '/profile/' + nom
|
|
|
|
with Image.open(image) as img:
|
2022-08-07 07:32:42 +02:00
|
|
|
img.thumbnail((300,200))
|
|
|
|
img.save( DOSSIER_PERSO + UTILISATEUR + '/profile/' + nom)
|
|
|
|
filename = nom
|
2022-08-06 18:22:24 +02:00
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
2022-07-10 15:09:03 +02:00
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
cursor.execute("UPDATE users SET avatar=? WHERE name=?",
|
2022-08-07 07:32:42 +02:00
|
|
|
(filename, UTILISATEUR))
|
2022-07-10 15:09:03 +02:00
|
|
|
conn.commit()
|
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
conn.close()
|
|
|
|
flash(u'Image de profil mise à jour', 'succes')
|
|
|
|
|
|
|
|
else:
|
2022-08-06 18:22:24 +02:00
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
|
|
|
cursor = conn.cursor() # Création de l\'objet "curseur"
|
2022-07-10 15:09:03 +02:00
|
|
|
cursor.execute("UPDATE users SET nom=?, prenom=?, age=?, mail_rescue=? WHERE name=?",
|
|
|
|
(profil_user['nom'], profil_user['prenom'], profil_user['age'], profil_user['mail_rescue'],
|
|
|
|
UTILISATEUR))
|
|
|
|
conn.commit()
|
|
|
|
flash(u'Le profil a été mis à jour', 'succes')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-11 00:36:31 +02:00
|
|
|
return render_template('profil.html',
|
|
|
|
section="Profil",
|
|
|
|
profil=profil_user,
|
|
|
|
username=UTILISATEUR)
|
2020-11-29 02:05:19 +01:00
|
|
|
|
|
|
|
else :
|
2022-08-06 23:49:16 +02:00
|
|
|
return redirect(BASE_URL, code=401)
|
2022-08-06 18:22:24 +02:00
|
|
|
|
|
|
|
@profil.route('/profil/change-password/', methods=['GET','POST'] )
|
|
|
|
def change_passwd() :
|
|
|
|
if 'username' in session:
|
|
|
|
UTILISATEUR='%s' % escape(session['username'])
|
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
cursor.execute("""SELECT Mail, alias, xmpp FROM users WHERE name=?""", (UTILISATEUR,))
|
|
|
|
tmp = cursor.fetchone()
|
|
|
|
mailbox = dict()
|
|
|
|
mailbox['Mail'] = tmp[0]
|
|
|
|
mailbox['alias'] = tmp[1]
|
|
|
|
mailbox['xmpp'] = tmp[2]
|
|
|
|
|
2022-09-01 07:29:49 +02:00
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
if request.method == 'POST' :
|
|
|
|
|
2022-09-01 07:29:49 +02:00
|
|
|
password = request.form['password']
|
|
|
|
password_confirm = request.form['passwd_confirm']
|
|
|
|
|
|
|
|
if password == password_confirm and valid_passwd(password):
|
2022-08-06 18:22:24 +02:00
|
|
|
mail_passwd_change = 0
|
|
|
|
xmmp_passwd_change = 0
|
|
|
|
passwd = request.form['password']
|
2022-09-01 07:29:49 +02:00
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
if MAIL_SERVER:
|
2022-09-01 07:29:49 +02:00
|
|
|
cmd = SETUID+ ' set_mail_passwd ' + '"'+mailbox['Mail']+'" '+ '"'+passwd+'"'
|
2022-08-07 06:10:36 +02:00
|
|
|
mail_passwd_change = os.system(cmd)
|
|
|
|
|
|
|
|
|
|
|
|
if XMPP_SERVER:
|
|
|
|
tmp = mailbox['Mail'].split('@')
|
|
|
|
cmd = SETUID+ " prosodyctl register '"+tmp[0]+"' " + "'"+tmp[1]+"' " + "'"+passwd+"'"
|
|
|
|
res = os.system(cmd)
|
|
|
|
if res != 0:
|
2022-08-06 18:22:24 +02:00
|
|
|
flash(u'Il y a eu un problème pour le changement du mot de passe du compte XMPP !', 'error')
|
|
|
|
|
|
|
|
|
|
|
|
if mail_passwd_change == 0:
|
|
|
|
passwd_bcrypt = bcrypt.generate_password_hash(passwd)
|
|
|
|
cursor.execute("UPDATE users SET passwd=? WHERE name=?",
|
|
|
|
(passwd_bcrypt, UTILISATEUR))
|
|
|
|
conn.commit()
|
|
|
|
TIME=time.strftime("%A %d %B %Y %H:%M:%S")
|
|
|
|
IP=request.environ['REMOTE_ADDR']
|
|
|
|
CLIENT_PLATFORM=request.headers.get('User-Agent')
|
|
|
|
log=TIME + ' - ' + IP + ' - ' + UTILISATEUR + ' - ' + CLIENT_PLATFORM + '\n' + '---> ' + "Changement du mot de passe" + '\n'
|
|
|
|
append_to_log(log, UTILISATEUR)
|
|
|
|
flash(u'Votre mot de passe a été changé', 'succes')
|
2022-09-01 07:29:49 +02:00
|
|
|
else:
|
|
|
|
if not( valid_passwd(password) ):
|
|
|
|
flash(u'Le mot de passe ne peut pas contenir les caractères " et &', 'error')
|
|
|
|
else:
|
|
|
|
flash(u'Les mot de passes ne sont pas identique :/ ', 'error')
|
2022-08-06 18:22:24 +02:00
|
|
|
|
|
|
|
conn.close()
|
|
|
|
return render_template('mailbox.html',
|
2022-08-06 23:49:16 +02:00
|
|
|
section="Profil",
|
2022-08-06 18:22:24 +02:00
|
|
|
address=mailbox['Mail'],
|
|
|
|
alias=mailbox['alias'],
|
|
|
|
username=UTILISATEUR)
|
|
|
|
|
|
|
|
else :
|
2022-08-06 23:49:16 +02:00
|
|
|
return redirect(BASE_URL, code=401)
|
2022-08-06 18:22:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
@profil.route('/mymailbox/alias', methods=['GET', 'POST'] )
|
|
|
|
def myalias():
|
|
|
|
hostname=gethostname()
|
|
|
|
if 'username' in session:
|
|
|
|
UTILISATEUR='%s' % escape(session['username'])
|
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
if request.method == 'POST' and MAIL_SERVER:
|
|
|
|
if request.form['alias']:
|
2022-08-12 16:18:46 +02:00
|
|
|
alias = request.form['alias'].lower()+'@'+hostname
|
2022-08-06 18:22:24 +02:00
|
|
|
else:
|
|
|
|
flash(u'Addresse invalide')
|
|
|
|
|
|
|
|
if email_disp(alias):
|
|
|
|
cursor.execute("""SELECT Mail, alias FROM users where name=?""", (UTILISATEUR,))
|
|
|
|
tmp = cursor.fetchone()
|
|
|
|
mail = tmp[0]
|
|
|
|
if tmp[1]:
|
|
|
|
alias_list = tmp[1]
|
|
|
|
aliases = alias_list + "," +alias
|
|
|
|
else:
|
|
|
|
aliases = alias
|
2022-08-07 17:36:20 +02:00
|
|
|
cmd = SETUID+ " set_mail_alias " + "'"+mail+"'"+" add "+"'"+alias+"'"
|
2022-08-07 06:10:36 +02:00
|
|
|
res = os.system(cmd)
|
|
|
|
if res == 0:
|
2022-08-06 18:22:24 +02:00
|
|
|
cursor.execute("UPDATE users SET alias=? WHERE name=?",
|
|
|
|
(aliases, UTILISATEUR))
|
|
|
|
conn.commit()
|
|
|
|
TIME=time.strftime("%A %d %B %Y %H:%M:%S")
|
|
|
|
IP=request.environ['REMOTE_ADDR']
|
|
|
|
CLIENT_PLATFORM=request.headers.get('User-Agent')
|
|
|
|
|
|
|
|
log=TIME + ' - ' + IP + ' - ' + UTILISATEUR + ' - ' + CLIENT_PLATFORM + '\n' + '---> ' + "Ajout de l'alias "+ alias + '\n'
|
|
|
|
append_to_log(log, UTILISATEUR)
|
|
|
|
flash(u'Votre alias a été ajouté', 'succes')
|
|
|
|
else:
|
|
|
|
flash(u'Adresse indisponible', 'error')
|
|
|
|
else:
|
|
|
|
flash(u'Adresse indisponible', 'error')
|
|
|
|
|
|
|
|
cursor.execute("""SELECT Mail, alias FROM users WHERE name=?""",
|
|
|
|
(UTILISATEUR,))
|
|
|
|
tmp = cursor.fetchone()
|
|
|
|
mailbox = dict()
|
|
|
|
mailbox['Mail'] = tmp[0]
|
|
|
|
if tmp[1]:
|
|
|
|
mailbox['alias'] = tmp[1].split(',')
|
|
|
|
else:
|
|
|
|
mailbox['alias'] = list()
|
|
|
|
conn.close()
|
|
|
|
return render_template('myalias.html',
|
|
|
|
section="mailbox",
|
|
|
|
email=mailbox['Mail'],
|
|
|
|
aliases=mailbox['alias'],
|
|
|
|
hostname=hostname,
|
2022-08-07 17:36:20 +02:00
|
|
|
MAIL_SERVER=MAIL_SERVER,
|
2022-08-06 18:22:24 +02:00
|
|
|
username=UTILISATEUR )
|
|
|
|
|
|
|
|
else:
|
2022-08-06 23:49:16 +02:00
|
|
|
return redirect(BASE_URL, code=401)
|
2022-08-06 18:22:24 +02:00
|
|
|
|
|
|
|
@profil.route('/mymailbox/rmalias/<aliasrm>')
|
|
|
|
def remove_alias(aliasrm):
|
|
|
|
if 'username' in session:
|
|
|
|
if MAIL_SERVER:
|
|
|
|
UTILISATEUR='%s' % escape(session['username'])
|
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
cursor.execute("""SELECT Mail, alias FROM users WHERE name=?""", (UTILISATEUR,))
|
|
|
|
tmp = cursor.fetchone()
|
|
|
|
mail = tmp[0]
|
|
|
|
alias_list = tmp[1].split(',')
|
|
|
|
aliases = ""
|
|
|
|
for alias in alias_list:
|
|
|
|
if alias != aliasrm:
|
|
|
|
if aliases:
|
|
|
|
aliases = aliases + "," + alias
|
|
|
|
else:
|
|
|
|
aliases = alias
|
2022-09-01 07:29:49 +02:00
|
|
|
cmd = SETUID + " set_mail_alias " + "'"+mail+"'"+" del "+"'"+alias+"'"
|
2022-08-07 06:10:36 +02:00
|
|
|
res = os.system(cmd)
|
|
|
|
if res == 0:
|
2022-08-06 18:22:24 +02:00
|
|
|
cursor.execute("UPDATE users SET alias=? WHERE name=?",
|
|
|
|
(aliases, UTILISATEUR))
|
|
|
|
conn.commit()
|
|
|
|
TIME=time.strftime("%A %d %B %Y %H:%M:%S")
|
|
|
|
IP=request.environ['REMOTE_ADDR']
|
|
|
|
CLIENT_PLATFORM=request.headers.get('User-Agent')
|
|
|
|
log = TIME + ' - ' + IP + ' - ' + UTILISATEUR + ' - ' + CLIENT_PLATFORM + '\n' + '---> ' + "Suppression de l'alias "+ alias + '\n'
|
|
|
|
append_to_log(log, UTILISATEUR)
|
|
|
|
flash(u'Votre alias a été supprimé', 'succes')
|
|
|
|
else:
|
|
|
|
flash(u'Il y a eu une erreur', 'error')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return redirect(url_for('profil.myalias', _external=True))
|
|
|
|
else:
|
2022-08-06 23:49:16 +02:00
|
|
|
return redirect(BASE_URL, code=401)
|
2022-08-06 18:22:24 +02:00
|
|
|
|
|
|
|
@profil.route('/invitation/', methods=['GET'])
|
|
|
|
def invitation():
|
|
|
|
if 'username' in session:
|
|
|
|
UTILISATEUR='%s' % escape(session['username'])
|
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
cursor.execute("""SELECT Token, invitations FROM users WHERE name=?""", (UTILISATEUR,))
|
|
|
|
tmp = cursor.fetchone()
|
|
|
|
token = tmp[0]
|
2022-08-07 17:36:20 +02:00
|
|
|
if token:
|
|
|
|
url_invitation = BASE_URL + 'inscription/' + token
|
|
|
|
else:
|
|
|
|
url_invitation = ""
|
2022-08-06 18:22:24 +02:00
|
|
|
invitations_count = tmp[1]
|
|
|
|
conn.close()
|
2022-08-07 17:36:20 +02:00
|
|
|
|
2022-08-06 18:22:24 +02:00
|
|
|
return render_template('invitation.html',
|
|
|
|
section='Profil',
|
|
|
|
nb_invitation=invitations_count,
|
2022-08-06 23:49:16 +02:00
|
|
|
token=token,
|
|
|
|
url_invitation=url_invitation)
|
2022-08-06 18:22:24 +02:00
|
|
|
else:
|
2022-08-06 23:49:16 +02:00
|
|
|
return redirect(BASE_URL, code=401)
|
2022-08-06 18:22:24 +02:00
|
|
|
|
|
|
|
@profil.route('/gen_token/', methods=['GET'])
|
|
|
|
def generate_token():
|
|
|
|
if 'username' in session:
|
|
|
|
UTILISATEUR='%s' % escape(session['username'])
|
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
token = gen_token()
|
|
|
|
cursor.execute("UPDATE users SET Token=? WHERE name=?",
|
|
|
|
(token, UTILISATEUR))
|
|
|
|
conn.commit()
|
|
|
|
conn.close()
|
2022-08-06 23:49:16 +02:00
|
|
|
return redirect(BASE_URL+'invitation/')
|
2022-08-06 18:22:24 +02:00
|
|
|
else:
|
2022-08-06 23:49:16 +02:00
|
|
|
return redirect(BASE_URL, code=401)
|
2023-07-06 05:07:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
@profil.route( '/delete_me/', methods=['GET','POST'])
|
|
|
|
def delete_account():
|
|
|
|
if 'username' in session :
|
|
|
|
UTILISATEUR='%s'% escape(session['username'])
|
|
|
|
resp = render_template('delete_account.html', time_backup=BACKUP_TIME)
|
|
|
|
if request.method == 'POST' :
|
|
|
|
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
|
|
|
cursor = conn.cursor() # Création de l'objet "curseur"
|
|
|
|
cursor.execute("""SELECT passwd FROM users WHERE name=?""", (UTILISATEUR,))
|
|
|
|
passwd = cursor.fetchone()[0]
|
2024-03-31 01:37:25 +01:00
|
|
|
cursor.execute("""SELECT mail FROM users WHERE name=?""", (UTILISATEUR,))
|
|
|
|
mail = cursor.fetchone()[0]
|
2023-07-06 05:07:34 +02:00
|
|
|
conn.close()
|
|
|
|
password = request.form['passwd']
|
|
|
|
if bcrypt.check_password_hash(passwd, password) is True:
|
|
|
|
not_error = True
|
2024-03-31 01:37:25 +01:00
|
|
|
|
2023-07-06 05:07:34 +02:00
|
|
|
if MAIL_SERVER:
|
|
|
|
try:
|
2024-03-31 01:37:25 +01:00
|
|
|
cmd = SETUID + ' set_mail_passwd del ' + '"'+mail+'"'
|
|
|
|
print(cmd)
|
|
|
|
os.system(cmd)
|
2023-07-06 05:07:34 +02:00
|
|
|
except:
|
|
|
|
not_error = False
|
|
|
|
flash(u'Erreur lors de la suppression de votre compte Mail.', 'error')
|
2024-03-31 01:37:25 +01:00
|
|
|
|
|
|
|
|
2023-07-06 05:07:34 +02:00
|
|
|
|
|
|
|
if XMPP_SERVER:
|
|
|
|
try:
|
|
|
|
tmp = mail.split('@')
|
|
|
|
cmd = SETUID+ ' prosodyctl deluser ' "'"+tmp[0]+"' " + "'"+tmp[1]+"'"
|
2024-03-31 01:37:25 +01:00
|
|
|
os.system(cmd)
|
2023-07-06 05:07:34 +02:00
|
|
|
except:
|
|
|
|
not_error = False
|
|
|
|
flash(u'Erreur lors de la suppression de votre compte XMPP.', 'error')
|
|
|
|
|
|
|
|
if not_error:
|
2024-03-31 01:37:25 +01:00
|
|
|
try:
|
|
|
|
cmd = 'rm -r ' + DATAS_USER + '/' + UTILISATEUR
|
|
|
|
if os.system(cmd) != 0:
|
|
|
|
raise TypeError("Remove directory error")
|
|
|
|
except:
|
|
|
|
flash(u'Erreur lors de la suppression de votre dossier utilisateur.', 'error')
|
|
|
|
|
|
|
|
|
2023-07-06 05:07:34 +02:00
|
|
|
try:
|
|
|
|
conn = sqlite3.connect(DATABASE)
|
|
|
|
cursor = conn.cursor()
|
|
|
|
cursor.execute("""DELETE FROM users WHERE name=?""", (UTILISATEUR,))
|
|
|
|
cursor.execute("""DELETE FROM posts WHERE author=?""", (UTILISATEUR,))
|
|
|
|
conn.commit()
|
|
|
|
conn.close()
|
|
|
|
except:
|
|
|
|
flash(u'Erreur lors de la suppression de votre compte.', 'error')
|
|
|
|
else:
|
|
|
|
flash(u'Désinscription réalisé avec succés, y\'a plus rien !', 'succes')
|
|
|
|
resp = redirect(url_for('loginlogout.logout'))
|
|
|
|
else:
|
|
|
|
flash(u'Mauvais mot de passe', 'error')
|
|
|
|
return resp
|
|
|
|
|