12/08/22 -17h
parent
42912cca75
commit
acf76d3222
|
@ -343,7 +343,7 @@ def add_user_account(diction):
|
||||||
for val in incom_keys:
|
for val in incom_keys:
|
||||||
if val not in field_list:
|
if val not in field_list:
|
||||||
mycommon.myprint(" Le champ '" + val + "' n'existe pas, MAJ annulée")
|
mycommon.myprint(" Le champ '" + val + "' n'existe pas, MAJ annulée")
|
||||||
return False, "Impossible d'ajouter le compte utilisateur"
|
return False, "Impossible d'ajouter le compte utilisateur. Toutes les informations fournies ne sont pas valables"
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -354,7 +354,7 @@ def add_user_account(diction):
|
||||||
for val in field_list_obligatoire :
|
for val in field_list_obligatoire :
|
||||||
if val not in diction:
|
if val not in diction:
|
||||||
mycommon.myprint(" La valeur '"+val+"' n'est pas presente dans liste ")
|
mycommon.myprint(" La valeur '"+val+"' n'est pas presente dans liste ")
|
||||||
return False, "Impossible d'ajouter le compte utilisateur"
|
return False, "Impossible d'ajouter le compte utilisateur. Toutes les informations necessaires n'ont pas été fournies"
|
||||||
|
|
||||||
# recuperation des paramettre
|
# recuperation des paramettre
|
||||||
myuser = {}
|
myuser = {}
|
||||||
|
@ -390,7 +390,7 @@ def add_user_account(diction):
|
||||||
|
|
||||||
if( tmp > 0 ):
|
if( tmp > 0 ):
|
||||||
mycommon.myprint("l'adresse email '"+str(myuser['email'])+"' existe deja, impossible de créer le compte ")
|
mycommon.myprint("l'adresse email '"+str(myuser['email'])+"' existe deja, impossible de créer le compte ")
|
||||||
return False, " Ce compte utilisateur deja"
|
return False, " Ce compte utilisateur existe deja"
|
||||||
|
|
||||||
|
|
||||||
ret_val = coll_name.insert_one(myuser)
|
ret_val = coll_name.insert_one(myuser)
|
||||||
|
|
17
email_mgt.py
17
email_mgt.py
|
@ -63,6 +63,14 @@ Pour activer votre compte, veuillez cliquer sur le lien ci-dessous :
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</b>
|
</b>
|
||||||
|
|
||||||
|
ou
|
||||||
|
<b> <a href="http://localhost:5000/myclass/api/valide_user_account/{objId}" target="_blank" style="color: white;">
|
||||||
|
CLIQUEZ ICI (local)
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</b>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -666,7 +674,7 @@ def SendGenericEmail(mail_recever=None, mail_object=None, mail_message=None):
|
||||||
Apres l'activation du compte pro,
|
Apres l'activation du compte pro,
|
||||||
cet email envoie le token et mot de passe temporaire à l'utilisateur
|
cet email envoie le token et mot de passe temporaire à l'utilisateur
|
||||||
'''
|
'''
|
||||||
def Pro_Account_Token_Pass(account_mail, my_token, my_tmp_pwd):
|
def Pro_Account_Token_Pass(account_mail, my_token):
|
||||||
try:
|
try:
|
||||||
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
|
tomorrow = datetime.date.today() + datetime.timedelta(days=1)
|
||||||
tomorrow_day = tomorrow.strftime("%A")
|
tomorrow_day = tomorrow.strftime("%A")
|
||||||
|
@ -685,7 +693,6 @@ def Pro_Account_Token_Pass(account_mail, my_token, my_tmp_pwd):
|
||||||
msg['To'] = str(toaddrs)
|
msg['To'] = str(toaddrs)
|
||||||
msg['Cc'] = 'contact@mysy-training.com'
|
msg['Cc'] = 'contact@mysy-training.com'
|
||||||
|
|
||||||
tmp_pwd = my_tmp_pwd
|
|
||||||
cle = my_token
|
cle = my_token
|
||||||
|
|
||||||
print(" mail enoye à toaddrs : " + str(msg['To']))
|
print(" mail enoye à toaddrs : " + str(msg['To']))
|
||||||
|
@ -714,9 +721,7 @@ def Pro_Account_Token_Pass(account_mail, my_token, my_tmp_pwd):
|
||||||
<li>
|
<li>
|
||||||
Email de connexion : l'email de connexion correspond à l'adresse de cette boite email.
|
Email de connexion : l'email de connexion correspond à l'adresse de cette boite email.
|
||||||
</li>
|
</li>
|
||||||
<li>Votre mot de passe temporaire : {tmp_pwd}<br>
|
|
||||||
<i>Nous vous recommandons de changer ce mot de passe apres la première connection.</i>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
Votre clé secrète : {cle} </li>
|
Votre clé secrète : {cle} </li>
|
||||||
</li>
|
</li>
|
||||||
|
@ -778,7 +783,7 @@ Conformément à la Loi Informatique et Liberté Loi n° 78-17 du 6 janvier 1978
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
'''.format(code=tomorrow_day, destinataire=account_mail, cle=cle, tmp_pwd=tmp_pwd)
|
'''.format(code=tomorrow_day, destinataire=account_mail, cle=cle)
|
||||||
html_mime = MIMEText(html, 'html')
|
html_mime = MIMEText(html, 'html')
|
||||||
|
|
||||||
# msg.attach(texte_mime)
|
# msg.attach(texte_mime)
|
||||||
|
|
5
main.py
5
main.py
|
@ -219,9 +219,10 @@ def valide_user_account(value):
|
||||||
url = ""
|
url = ""
|
||||||
if( status ):
|
if( status ):
|
||||||
url = 'https://www.mysy-training.com/mysy-account-activated/'
|
url = 'https://www.mysy-training.com/mysy-account-activated/'
|
||||||
#url = 'http://localhost:3009/mysy-account-activated/'
|
url = 'http://localhost:3009/mysy-account-activated/'
|
||||||
else:
|
else:
|
||||||
url = 'https://www.mysy-training.com/erreur'
|
url = 'https://www.mysy-training.com/erreur'
|
||||||
|
url = 'http://localhost:3009/erreur/'
|
||||||
|
|
||||||
return redirect(url)
|
return redirect(url)
|
||||||
|
|
||||||
|
@ -505,7 +506,7 @@ def valide_partnair_account(value):
|
||||||
|
|
||||||
if (result):
|
if (result):
|
||||||
url = 'https://www.mysy-training.com/PartnerLogin0/'
|
url = 'https://www.mysy-training.com/PartnerLogin0/'
|
||||||
#url = 'http://localhost:3009/PartnerLogin0'
|
url = 'http://localhost:3009/PartnerLogin0'
|
||||||
else:
|
else:
|
||||||
url = 'https://www.mysy-training.com/erreur'
|
url = 'https://www.mysy-training.com/erreur'
|
||||||
|
|
||||||
|
|
11
partners.py
11
partners.py
|
@ -63,7 +63,7 @@ def add_partner_account(diction):
|
||||||
for val in incom_keys:
|
for val in incom_keys:
|
||||||
if val not in field_list:
|
if val not in field_list:
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Creation partner account : Le champ '" + val + "' n'est pas autorisé, Creation partenaire annulée")
|
mycommon.myprint(str(inspect.stack()[0][3]) + " - Creation partner account : Le champ '" + val + "' n'est pas autorisé, Creation partenaire annulée")
|
||||||
return False, "Impossible de créer le partenaire"
|
return False, "Impossible de créer le partenaire. Toutes les informations fournies ne sont pas valables"
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||||
|
@ -73,7 +73,7 @@ def add_partner_account(diction):
|
||||||
for val in field_list_obligatoire :
|
for val in field_list_obligatoire :
|
||||||
if val not in diction:
|
if val not in diction:
|
||||||
mycommon.myprint( str(inspect.stack()[0][3]) + " - : La valeur '"+val+"' n'est pas presente dans liste ")
|
mycommon.myprint( str(inspect.stack()[0][3]) + " - : La valeur '"+val+"' n'est pas presente dans liste ")
|
||||||
return False, "Impossible de créer le partenaire"
|
return False, "Impossible de créer le partenaire, Toutes les informations necessaires n'ont pas été fournies"
|
||||||
|
|
||||||
# recuperation des paramettre
|
# recuperation des paramettre
|
||||||
mydata = {}
|
mydata = {}
|
||||||
|
@ -157,6 +157,7 @@ def add_partner_account(diction):
|
||||||
|
|
||||||
mydata['active'] = '0'
|
mydata['active'] = '0'
|
||||||
mydata['locked'] = '0'
|
mydata['locked'] = '0'
|
||||||
|
mydata['ispending'] = "1"
|
||||||
|
|
||||||
print(str(datetime.now()) + " webservice : diction = "+str(mydata))
|
print(str(datetime.now()) + " webservice : diction = "+str(mydata))
|
||||||
|
|
||||||
|
@ -541,6 +542,7 @@ def update_partner_account(diction):
|
||||||
|
|
||||||
mydata['date_update'] = str(datetime.now())
|
mydata['date_update'] = str(datetime.now())
|
||||||
|
|
||||||
|
|
||||||
#print(str(datetime.now()) + " webservice : diction = " + str(mydata))
|
#print(str(datetime.now()) + " webservice : diction = " + str(mydata))
|
||||||
|
|
||||||
coll_name = MYSY_GV.dbname['partnair_account']
|
coll_name = MYSY_GV.dbname['partnair_account']
|
||||||
|
@ -602,14 +604,13 @@ def valide_partnair_account(value):
|
||||||
'''
|
'''
|
||||||
Create default / temporary pwd for new account
|
Create default / temporary pwd for new account
|
||||||
'''
|
'''
|
||||||
my_tmp_pwd = mycommon.create_token_urlsafe();
|
#my_tmp_pwd = mycommon.create_token_urlsafe();
|
||||||
|
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
ret_val = coll_name.find_and_modify(query={'_id':ObjectId(str(value)), 'locked':'0'},
|
ret_val = coll_name.find_and_modify(query={'_id':ObjectId(str(value)), 'locked':'0'},
|
||||||
update={"$set":
|
update={"$set":
|
||||||
{'active': "1","date_update":str(now),
|
{'active': "1","date_update":str(now),
|
||||||
'token':str(my_token),
|
'token':str(my_token),
|
||||||
'pwd':my_tmp_pwd
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -617,7 +618,7 @@ def valide_partnair_account(value):
|
||||||
if( ret_val and ret_val['_id']):
|
if( ret_val and ret_val['_id']):
|
||||||
mycommon.myprint("La modif a bien ete faite Ajout Token OK, ="+str(ret_val['_id']))
|
mycommon.myprint("La modif a bien ete faite Ajout Token OK, ="+str(ret_val['_id']))
|
||||||
# Envoie du mail de notification
|
# Envoie du mail de notification
|
||||||
mail.Pro_Account_Token_Pass(partner_email, my_token, my_tmp_pwd)
|
mail.Pro_Account_Token_Pass(partner_email, my_token)
|
||||||
return 'True', my_token
|
return 'True', my_token
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue