05/04/22 - 10h30

master
ChérifBALDE 2022-04-05 10:57:34 +02:00 committed by cherif
parent 47ab74a287
commit 8dafdc7366
2 changed files with 51 additions and 32 deletions

View File

@ -18,7 +18,7 @@ password = 'Vince1234!'
smtp_address = 'smtp-relay.sendinblue.com'
port = 587
sender = 'billardman01@hotmail.com'
receiver = ["cherif.balde@yahoo.fr","cbalde@bigben-connected.com"]
receiver = ["cbalde3@mysy-training.com","billardman1@gmail.com"]
user = 'billardman01@hotmail.com'
@ -30,8 +30,8 @@ def send_user_account_mail(message, account_mail):
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
tomorrow_day = tomorrow.strftime("%A")
receiver = ["cherif.balde@yahoo.fr","cbalde@bigben-connected.com",str(account_mail)]
toaddrs = ", ".join(receiver)
receiver = ["billardman01@hotmail.com", "cherif.balde@yahoo.fr", "cbalde@mysy-training.com","billardman1@gmail.com",str(account_mail)]
toaddrs = ",".join(receiver)
print(" mail enoye à : "+toaddrs)
@ -43,35 +43,52 @@ def send_user_account_mail(message, account_mail):
msg['Subject'] = 'MySy : test email activation compte '
msg['From'] = 'billardman01@hotmail.com'
msg['To'] = str(toaddrs)
msg['To'] = "cherif.balde@yahoo.fr,billardman01@hotmail.com"
html = '''
<html>
<!DOCTYPE html>
<html>
<body>
<p>Bonjour</p>
<p>Pour valider votre compte, merci de cliquer ici </b> </p>
<b>
<a href="http://89.156.84.196:5000/myclass/api/valide_user_account/{objId}" target="_blank" >
http://89.156.84.196:5000/myclass/api/valide_user_account/{objId}
</b>
<div style="background-color:#eee;padding:0px;text-align:center;width:100%">
<h2 style="font-family:Georgia, 'Times New Roman', Times, serif;color#454349;">
<img src="http://88.170.110.220/img/MYSY-LOGO-BLUE.png" alt="Mysy Training Logo" width="110px" height="70px"/> </h2>
</div>
<div style="padding:20px 0px;text-align:center;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:2rem;">
<div style="width:100%">
<div style="text-align:center;">
Bonjour
<div style="padding:20px 0px;text-align:center;font-family:Georgia, 'Times New Roman', Times, serif;color#454349;font-size:1rem;">
Votre adresse e-mail a bien été enregistrée sur le site <font color="green">MySy-Training</font>. <br>
Pour valider votre compte, veuillez cliquer sur le lien <font color="green">ci-dessous :</font>
<br/>
<br/>
<b> <a href="https://apimysy.iexercice.com/myclass/api/valide_user_account/{objId}" target="_blank" >
CLIQUEZ ICI
</a>
<b>
</b>
</font>
<br/>
<b>
<a href="http://127.0.0.1:5000/myclass/api/valide_user_account/{objId}" target="_blank" >
http://127.0.0.1:5000/myclass/api/valide_user_account/{objId}
CLIQUEZ ICI ==> LOCALHOST
</b>
</a>
<p>Cordialement<br>
L'equipe informatique de MySy
</p>
</p>
</div>
</div>
</body>
</html>
</html>
'''.format(code=tomorrow_day, objId=message)
@ -82,17 +99,9 @@ def send_user_account_mail(message, account_mail):
print("html_mime ="+str(html))
# filename = r"C:\Users\cbalde\OneDrive - bigben-connected.com\Bureau\En cours\SalesOutImport\example2.csv"
#attachment = open(filename, "rb")
# instance of MIMEBase and named as p
#p = MIMEBase('application', 'octet-stream')
# To change the payload into encoded form
#p.set_payload((attachment).read())
# encode into base64
#encoders.encode_base64(p)
#p.add_header('Content-Disposition', "attachment; filename= LogisticReport_GDT.csv")
#msg.attach(p)
toaddr = str(account_mail)
cc = ['billardman01@hotmail.com']
toaddrs = [toaddr] + cc
# msg.attach(MIMEText(open(filename).read()))
@ -122,7 +131,7 @@ def send_partner_account_mail(message, account_mail):
msg['Subject'] = 'MySy : test email activation compte '
msg['From'] = 'billardman01@hotmail.com'
msg['To'] = str(toaddrs)
msg['Cc'] = 'cbalde@bigben-connected.com'
msg['Cc'] = 'cbalde@mysy-training.com'
html = '''
@ -132,8 +141,8 @@ def send_partner_account_mail(message, account_mail):
<p>Vous venez de créer un compte partenaire.
Pour activier votre compte, merci de cliquer ici </b> </p>
<b>
<a href="http://89.156.84.196:5000/myclass/api/valide_partnair_account/{objId}" target="_blank" >
http://89.156.84.196:5000/myclass/api/valide_partnair_account/{objId}
<a href="https://apimysy.iexercice.com/myclass/api/valide_partnair_account/{objId}" target="_blank" >
https://apimysy.iexercice.com/myclass/api/valide_partnair_account/{objId}
</b>
</a>

12
main.py
View File

@ -18,6 +18,9 @@ import Dev_api_functions as dev_function
from flask_cors import CORS, cross_origin
import time
from OpenSSL import SSL
from flask import redirect
from flask import Flask, render_template, request, redirect, url_for
DEBUG_LEVEL = logging.DEBUG
LOG_FILE_NAME = "./Log/log_file.log"
@ -213,7 +216,14 @@ def valide_user_account(value):
print(" ### validation du compte = ",value)
status, retval = eua.valide_user_account(value)
return jsonify(status=status, message=retval)
url = ""
if( status ):
url = 'https://dev.mysy-training.com/login'
else:
url = 'https://dev.mysy-training.com/erreur'
return redirect(url)
'''