Finalize delete account
This commit is contained in:
parent
f5901a2ed4
commit
beccb99088
@ -327,36 +327,42 @@ def delete_account():
|
||||
cursor = conn.cursor() # Création de l'objet "curseur"
|
||||
cursor.execute("""SELECT passwd FROM users WHERE name=?""", (UTILISATEUR,))
|
||||
passwd = cursor.fetchone()[0]
|
||||
cursor.execute("""SELECT mail FROM users WHERE name=?""", (UTILISATEUR,))
|
||||
mail = cursor.fetchone()[0]
|
||||
conn.close()
|
||||
password = request.form['passwd']
|
||||
if bcrypt.check_password_hash(passwd, password) is True:
|
||||
not_error = True
|
||||
try:
|
||||
cmd = 'rm -r ' + DATAS_USER + '/' + UTILISATEUR
|
||||
if system(cmd) != 0:
|
||||
raise TypeError("Remove directory error")
|
||||
except:
|
||||
not_error = False
|
||||
flash(u'Erreur lors de la suppression de votre dossier utilisateur.', 'error')
|
||||
|
||||
|
||||
if MAIL_SERVER:
|
||||
try:
|
||||
cmd = SETUID + ' set_mail_passwd del' + '"'+mail+'"'
|
||||
system(cmd)
|
||||
cmd = SETUID + ' set_mail_passwd del ' + '"'+mail+'"'
|
||||
print(cmd)
|
||||
os.system(cmd)
|
||||
except:
|
||||
not_error = False
|
||||
flash(u'Erreur lors de la suppression de votre compte Mail.', 'error')
|
||||
|
||||
|
||||
|
||||
if XMPP_SERVER:
|
||||
try:
|
||||
tmp = mail.split('@')
|
||||
cmd = SETUID+ ' prosodyctl deluser ' "'"+tmp[0]+"' " + "'"+tmp[1]+"'"
|
||||
system(cmd)
|
||||
os.system(cmd)
|
||||
except:
|
||||
not_error = False
|
||||
flash(u'Erreur lors de la suppression de votre compte XMPP.', 'error')
|
||||
|
||||
if not_error:
|
||||
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')
|
||||
|
||||
|
||||
try:
|
||||
conn = sqlite3.connect(DATABASE)
|
||||
cursor = conn.cursor()
|
||||
|
Loading…
Reference in New Issue
Block a user