Commit 73851113 authored by Daniel STAN's avatar Daniel STAN

deconnexion.py: on teste l'url de reconnexion

parent 45eb0bbd
......@@ -17,6 +17,7 @@ Content-Type: text/plain; charset="utf-8"
%(proprio)s uploade actuellement %(upload)s Mio.
--\u0020
Message créé par deconnexion.py"""
......@@ -32,14 +33,16 @@ La chambre de l'adhérent est %(chambre)s.
analyse.py devrait bientôt avoir généré un fichier que vous pourrez lui envoyer en cas de demande. Le fichier sera dans le dossier /usr/scripts/var/analyse/.
Test: url de reconnexion: %(reco_url)s.
--\u0020
Message créé par deconnexion.py
""" + (" __1__"+10*" "+3*"%"+","+7*"%"+"\n \_._/"+11*" "+",'%% \\-*"+7*"%"+"\n ( ^ )"+5*" "+";"+5*"%"+"*% _%%%%\"\n"+2*" "+"`='|\."+4*" "+",%%%"+7*" "+"\(_.*%%%%.\n"+4*" "+"/ |"+4*" "+"% *%%, ,"+4*"%"+"*("+4*" "+"'\n (/ | %^"+5*" "+",*%%% )\|,%%*%,_\n |__, |"+7*" "+"*%"+4*" "+"\/ #).-\"*%%*\n | |"+11*" "+"_.) ,/ *%,\n | | "+9*"_"+"/)#("+12*"_"+"\n /___| |"+25*"_"+"|\n ===").replace("%", "%%")
def __init__(self, emetteur, destinataires, proprio, id, upload, mdc, chambre):
def __init__(self, emetteur, destinataires, proprio, id, upload, mdc, chambre, reco_url):
self.proprio = proprio
self.id, self.upload, self.mdc, self.chambre = id, upload, mdc, chambre
self.id, self.upload, self.mdc, self.chambre, self.reco_url = id, upload, mdc, chambre, reco_url
self.objet = u"%s a été bridé" % (proprio)
self.corps = self.template
super(Message_disconnect_hard, self).__init__(emetteur, destinataires, self.objet, self.corps)
......
#! /usr/bin/env python
#!/bin/bash /usr/scripts/python.sh
# -*- coding: utf-8 -*-
"""
......@@ -19,22 +19,21 @@ Licence : GPL v2
import commands
import sys
import psycopg2
sys.path.append('/usr/scripts/gestion')
from config import upload, virus, NETs, plage_ens, prefix
import config.mails.upload
import ipt
import smtplib
from ldap_crans import crans_ldap
from ldap_crans import MachineWifi
from ldap_crans import MachineFixe
from time import *
sys.path.append('/usr/scripts/surveillance/fiche_deconnexion')
from generate import generate_ps
from affich_tools import tableau
import analyse2 as analyse
from gestion.config import upload, virus, NETs, plage_ens, prefix
import gestion.config.mails.upload as mails_upload
from gestion import ipt
from gestion.ldap_crans import crans_ldap
from gestion.ldap_crans import MachineWifi
from gestion.ldap_crans import MachineFixe
import mail as mail_module
from surveillance.fiche_deconnexion.generate import generate_ps
from gestion.affich_tools import tableau
import surveillance.analyse2 as analyse
import gestion.mail as mail_module
# ldap
ldap = crans_ldap()
......@@ -202,6 +201,20 @@ for elupload, eltype, elid in uploadeurs:
# On envoie un mail à l'adhérent
################################
if eltype == "club":
theid = "cid="
else:
theid = "aid="
theid += proprio.id()
# Test: validation_url('upload')
try:
data = {'dn': theid,
'blid': len(proprio.blacklist())-1}
reco_url = mail_module.validation_url('upload', data)
except Exception as e:
reco_url = "[[erreur de génération: %r]]" % e
mail = connectsmtp()
corps = mail_module.generate('upload_hard', {'from': upload.expediteur, 'to': proprio.email(), 'upload': "%.2f" % (elupload,), 'proprio': proprio.Nom(), 'lang_info':'English version below'}).as_string()
......@@ -210,11 +223,11 @@ for elupload, eltype, elid in uploadeurs:
# On envoie un mail à disconnect
################################
if upload.disconnect_mail_hard:
if eltype == "club":
theid = "cid="
else:
theid = "aid="
mail_disconnect_hard = config.mails.upload.Message_disconnect_hard(upload.expediteur, upload.expediteur, proprio=proprio.Nom(), id=theid + proprio.id(), upload="%.2f" % (elupload,), mdc=mdcf, chambre=proprio.chbre())
mail_disconnect_hard = mails_upload.Message_disconnect_hard(upload.expediteur,
upload.expediteur, proprio=proprio.Nom(), id=theid,
upload="%.2f" % (elupload,), mdc=mdcf, chambre=proprio.chbre(),
reco_url=reco_url,
)
mail_disconnect_hard.send()
# Vérification du nombre de déconnexions
......@@ -230,7 +243,7 @@ for elupload, eltype, elid in uploadeurs:
+ "/usr/scripts/surveillance/fiche_deconnexion/generate.py --upload aid=%d" % int(proprio.id()))
# Envoi du mail à disconnect
corps = config.mails.upload.message_disconnect_multi % {'from': upload.expediteur, 'to': upload.expediteur, 'nbdeco': nb_decos, 'proprio': proprio.Nom(), 'ps': fichier_ps}
corps = mails_upload.message_disconnect_multi % {'from': upload.expediteur, 'to': upload.expediteur, 'nbdeco': nb_decos, 'proprio': proprio.Nom(), 'ps': fichier_ps}
corps = corps.encode('utf-8')
mail.sendmail(upload.expediteur, upload.expediteur, corps)
......@@ -268,7 +281,7 @@ for elupload, eltype, elid in uploadeurs:
# On envoie un mail à disconnect
################################
if upload.disconnect_mail_soft:
corps = config.mails.upload.message_disconnect_soft % {'from': upload.expediteur, 'to': upload.expediteur, 'upload': "%.2f" % (elupload,), 'proprio': proprio.Nom()}
corps = mails_upload.message_disconnect_soft % {'from': upload.expediteur, 'to': upload.expediteur, 'upload': "%.2f" % (elupload,), 'proprio': proprio.Nom()}
corps = corps.encode('utf-8')
mail.sendmail(upload.expediteur, upload.expediteur, corps)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment