20/01/2025 - 18h
parent
67b78062b9
commit
ef0672002c
|
@ -1,10 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="17/01/2025 - 15:30">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="18/01/2025 - 17h">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/GlobalVariable.py" beforeDir="false" afterPath="$PROJECT_DIR$/GlobalVariable.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/base_partner_catalog_config.py" beforeDir="false" afterPath="$PROJECT_DIR$/base_partner_catalog_config.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/crm_opportunite.py" beforeDir="false" afterPath="$PROJECT_DIR$/crm_opportunite.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ela_user_account.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_user_account.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/emargement.py" beforeDir="false" afterPath="$PROJECT_DIR$/emargement.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_client.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_client.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/user_session.py" beforeDir="false" afterPath="$PROJECT_DIR$/user_session.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -75,13 +84,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680804787304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00381" summary="dddqsd">
|
||||
<created>1724781881428</created>
|
||||
<option name="number" value="00381" />
|
||||
<option name="presentableId" value="LOCAL-00381" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1724781881429</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00382" summary="dddqsdd">
|
||||
<created>1724868784464</created>
|
||||
<option name="number" value="00382" />
|
||||
|
@ -418,7 +420,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1737124740624</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="430" />
|
||||
<task id="LOCAL-00430" summary="18/01/2025 - 17h">
|
||||
<created>1737217224338</created>
|
||||
<option name="number" value="00430" />
|
||||
<option name="presentableId" value="LOCAL-00430" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1737217224339</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="431" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -460,7 +469,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="07/10/2024 - 20h30" />
|
||||
<MESSAGE value="12/10/204 - 18h" />
|
||||
<MESSAGE value="13/10/2024 - 14h" />
|
||||
<MESSAGE value="13/10/2024 - sdf14h" />
|
||||
|
@ -485,6 +493,7 @@
|
|||
<MESSAGE value="04/01/2025 - 14h48" />
|
||||
<MESSAGE value="16/01/2025 - 16h30" />
|
||||
<MESSAGE value="17/01/2025 - 15:30" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="17/01/2025 - 15:30" />
|
||||
<MESSAGE value="18/01/2025 - 17h" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="18/01/2025 - 17h" />
|
||||
</component>
|
||||
</project>
|
|
@ -83,7 +83,7 @@ elif (MYSY_ENV == "DEM"):
|
|||
MYSY_DEBUG_LEVEL = 1
|
||||
|
||||
# Domaine pour le catalogue public
|
||||
MYSY_PUBLIC_CATALOG_DOMAIN = 'devmysy-hosting.online'
|
||||
MYSY_PUBLIC_CATALOG_DOMAIN = 'demomysy-hosting.online'
|
||||
|
||||
"""
|
||||
REPERTOIRE FTP DES IMAGES DU BLOG
|
||||
|
|
8703
Log/log_file.log
8703
Log/log_file.log
File diff suppressed because it is too large
Load Diff
|
@ -113,7 +113,7 @@ def Add_Update_Partner_Catalog_Pub_Config(diction):
|
|||
'indicateur_2_txt', 'indicateur_2_taille', 'indicateur_2_color', 'indicateur_2_gras',
|
||||
'indicateur_3_txt', 'indicateur_3_taille', 'indicateur_3_color', 'indicateur_3_gras',
|
||||
'indicateur_4_txt', 'indicateur_4_taille', 'indicateur_4_color', 'indicateur_4_gras',
|
||||
'cgv_pdf', 'cgu_pdf', 'mention_legale_pdf'
|
||||
'cgv_pdf', 'cgu_pdf', 'mention_legale_pdf', 'contact_public_email', 'contact_public_telephone'
|
||||
]
|
||||
|
||||
incom_keys = diction.keys()
|
||||
|
@ -249,6 +249,12 @@ def Get_Partner_Catalog_Pub_Config(diction):
|
|||
user['id'] = str(val_tmp)
|
||||
val_tmp = val_tmp + 1
|
||||
|
||||
if ("contact_public_email" not in retval.keys()):
|
||||
user['contact_public_email'] = ""
|
||||
|
||||
if ("contact_public_telephone" not in retval.keys()):
|
||||
user['contact_public_telephone'] = ""
|
||||
|
||||
if( "logo" not in retval.keys() ):
|
||||
user['logo'] = ""
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ def Add_CRM_Opportunite(diction):
|
|||
'locked': '0',
|
||||
}, {'description': 1, 'gagne': 1})
|
||||
|
||||
print(" #### new_status_id_data = ", new_status_id_data)
|
||||
#print(" #### new_status_id_data = ", new_status_id_data)
|
||||
|
||||
new_status_label = ""
|
||||
if (new_status_id_data and "description" in new_status_id_data.keys()):
|
||||
|
|
|
@ -779,6 +779,9 @@ def update_user_account(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le compte utilisateur"
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Recuperation d'un compte utilisateur
|
||||
'''
|
||||
|
@ -821,22 +824,7 @@ def get_user_account(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) +" L'email ou le token ne sont pas valides")
|
||||
return False, "L'email ou le token ne sont pas valides (1)"
|
||||
|
||||
'''
|
||||
# Verification si compte utilisateur à ete activé
|
||||
retval2, message = mycommon.check_user_validity("", token_value)
|
||||
if retval2 is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " le user account n'est valide ou est verrouillé")
|
||||
return False, message
|
||||
'''
|
||||
"""
|
||||
|
||||
# récupérer le _id de l'utilisation en partant du token
|
||||
user_recid = mycommon.get_user_recid_from_token(token_value)
|
||||
if user_recid is False :
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de récupérer le recid du user")
|
||||
return False, "Impossible de récupérer les données de l'utilisateur"
|
||||
|
||||
"""
|
||||
|
||||
|
||||
coll_name = MYSY_GV.dbname['user_account']
|
||||
|
||||
|
|
|
@ -1065,7 +1065,6 @@ def GerneratePDFEmargementList(diction):
|
|||
contenu_doc_Template = jinja2.Template(str(partner_document_data['contenu_doc']))
|
||||
|
||||
|
||||
|
||||
sourceHtml = contenu_doc_Template.render(json_data=body["data"], users=body["user"], company_data=body["company_data"])
|
||||
orig_file_name = "Emargement.pdf"
|
||||
outputFilename = str(MYSY_GV.EMARGEMENT_DIRECTORY) + str(orig_file_name)
|
||||
|
|
4
main.py
4
main.py
|
@ -188,8 +188,8 @@ def login():
|
|||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### payload = ",payload)
|
||||
status, retval = us.login(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
status, retval, firstconnexion = us.login(payload)
|
||||
return jsonify(status=status, message=retval, firstconnexion=firstconnexion)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,8 +5,12 @@ Cas d'utilisation :
|
|||
Un partenaire de mysy, souhaite créer (CRUD) ses clients
|
||||
Emettre des devis, bons de commandes, des factures, etc....
|
||||
"""
|
||||
import smtplib
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
|
||||
import pymongo
|
||||
from pandas.io.formats.style import jinja2
|
||||
from pymongo import MongoClient
|
||||
import json
|
||||
from bson import ObjectId
|
||||
|
@ -2601,11 +2605,8 @@ def Create_Partner_Client_Intranet_Account(diction):
|
|||
if ("adr_pays" in is_valide_client_partner_data.keys()):
|
||||
client_adr_pays = is_valide_client_partner_data['adr_pays']
|
||||
|
||||
|
||||
now = str(datetime.now())
|
||||
|
||||
|
||||
|
||||
new_data = {}
|
||||
new_data['nom'] = client_nom
|
||||
new_data['adr_street'] = client_adr_adresse
|
||||
|
@ -2614,8 +2615,6 @@ def Create_Partner_Client_Intranet_Account(diction):
|
|||
new_data['adr_country'] = client_adr_pays
|
||||
new_data['mob_phone'] = client_telephone
|
||||
|
||||
|
||||
|
||||
new_data['email'] = client_email
|
||||
new_data['pwd'] = str(client_pwd)
|
||||
new_data['recid'] = str(my_partner['recid'])
|
||||
|
@ -2626,6 +2625,8 @@ def Create_Partner_Client_Intranet_Account(diction):
|
|||
new_data['date_creation'] = now
|
||||
new_data['created_by'] = str(my_partner['_id'])
|
||||
new_data['type'] = "user"
|
||||
new_data['lastconnexion'] = ""
|
||||
new_data['firstconnexion'] = "1"
|
||||
|
||||
inserted_id = MYSY_GV.dbname['user_account'].insert_one(new_data).inserted_id
|
||||
if (not inserted_id):
|
||||
|
@ -2650,6 +2651,116 @@ def Create_Partner_Client_Intranet_Account(diction):
|
|||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
"""
|
||||
A présent que le compte est créé on va envoyer email de notification au client
|
||||
avec l'url, le login et pwd
|
||||
"""
|
||||
local_diction = {}
|
||||
local_diction['ref_interne'] = "INTRANET_CLIENT_LOGIN_NOTIF"
|
||||
local_diction['type_doc'] = "email"
|
||||
local_diction['partner_owner_recid'] = str(my_partner['recid'])
|
||||
|
||||
courrier_data_status, courrier_data_retval = mycommon.Get_Courrier_Template_Include_Default_Data(local_diction)
|
||||
if (courrier_data_status is False):
|
||||
return True, " WARNING : Le compte intranet du client a été mais impossible d'envoyer l'email de notification au client"
|
||||
|
||||
if ("contenu_doc" not in courrier_data_retval.keys() or str(courrier_data_retval['contenu_doc']) == ""):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][
|
||||
3]) + " Le modèle de courrier 'INTRANET_CLIENT_LOGIN_NOTIF' n'est pas correctement configuré ")
|
||||
return False, " Le modèle de courrier 'INTRANET_CLIENT_LOGIN_NOTIF' n'est pas correctement configuré "
|
||||
|
||||
convention_dictionnary_data = {}
|
||||
new_diction = {}
|
||||
new_diction['token'] = str(token)
|
||||
new_diction['list_stagiaire_id'] = []
|
||||
new_diction['list_session_id'] = []
|
||||
new_diction['list_class_id'] = []
|
||||
new_diction['list_client_id'] = []
|
||||
|
||||
new_diction['list_client_id'].append(ObjectId(str(diction['partner_client_id'])))
|
||||
local_status, local_retval = mycommon.Get_Dictionnary_data_For_Template(new_diction)
|
||||
|
||||
if (local_status is False):
|
||||
return local_status, local_retval
|
||||
|
||||
"""
|
||||
Recuperation du partnair_account.subdomaine_catalog_pub
|
||||
"""
|
||||
subdomaine_catalog_pub = ""
|
||||
admin_partnair = MYSY_GV.dbname['partnair_account'].find_one({'recid':str(my_partner['recid']), 'is_partner_admin_account':'1'}, {'subdomaine_catalog_pub':1})
|
||||
|
||||
if( admin_partnair and 'subdomaine_catalog_pub' in admin_partnair.keys() ):
|
||||
subdomaine_catalog_pub = admin_partnair['subdomaine_catalog_pub']
|
||||
else:
|
||||
return True, " WARNING : Le compte intranet du client a été mais impossible d'envoyer l'email de notification au client (22) "
|
||||
|
||||
|
||||
dictionnary_data = local_retval
|
||||
dictionnary_data['intranet_mysyurl'] = subdomaine_catalog_pub+"."+MYSY_GV.MYSY_PUBLIC_CATALOG_DOMAIN+"/intranet"
|
||||
dictionnary_data['intranet_login'] = client_email
|
||||
dictionnary_data['intranet_pwd'] = str(client_pwd)
|
||||
|
||||
# Recuperation des donnes smtp
|
||||
local_stpm_status, partner_SMTP_COUNT_smtpsrv, partner_own_smtp_value, partner_SMTP_COUNT_password, partner_SMTP_COUNT_user, partner_SMTP_COUNT_From_User, partner_SMTP_COUNT_port = mycommon.Get_Partner_SMTP_Param(
|
||||
my_partner['recid'])
|
||||
|
||||
if (local_stpm_status is False):
|
||||
return True, " WARNING : Le compte intranet du client a été mais impossible d'envoyer l'email de notification au client (2) "
|
||||
|
||||
|
||||
|
||||
body = {
|
||||
"params": dictionnary_data,
|
||||
}
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
smtpserver = smtplib.SMTP(partner_SMTP_COUNT_smtpsrv, partner_SMTP_COUNT_port)
|
||||
else:
|
||||
smtpserver = smtplib.SMTP(MYSY_GV.O365_SMTP_COUNT_smtpsrv, MYSY_GV.O365_SMTP_COUNT_port)
|
||||
|
||||
smtpserver.ehlo()
|
||||
smtpserver.starttls()
|
||||
smtpserver.login(MYSY_GV.O365_SMTP_COUNT_user, MYSY_GV.O365_SMTP_COUNT_password)
|
||||
|
||||
# Traitement du sujet du mail
|
||||
sujet_mail_Template = jinja2.Template(str(courrier_data_retval['sujet']))
|
||||
sujetHtml = sujet_mail_Template.render(params=body["params"])
|
||||
|
||||
# Traitement du corps du mail
|
||||
contenu_doc_Template = jinja2.Template(str(courrier_data_retval['contenu_doc']))
|
||||
sourceHtml = contenu_doc_Template.render(params=body["params"])
|
||||
html_mime = MIMEText(sourceHtml, 'html')
|
||||
|
||||
# Creation de l'email à enoyer
|
||||
msg = MIMEMultipart("alternative")
|
||||
|
||||
if (str(partner_own_smtp_value) == "1"):
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = partner_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
|
||||
#toaddrs = ",".join(client_email)
|
||||
msg['to'] = str(client_email)
|
||||
|
||||
val = smtpserver.send_message(msg)
|
||||
print(" Email de notification envoyé " + str(val))
|
||||
|
||||
else:
|
||||
msg.attach(html_mime)
|
||||
msg['From'] = MYSY_GV.O365_SMTP_COUNT_From_User
|
||||
msg['Bcc'] = 'contact@mysy-training.com'
|
||||
msg['Subject'] = sujetHtml
|
||||
|
||||
# toaddrs = ",".join(client_email)
|
||||
msg['to'] = str(client_email)
|
||||
val = smtpserver.send_message(msg)
|
||||
print(" Email de notification envoyé " + str(val))
|
||||
|
||||
smtpserver.close()
|
||||
|
||||
|
||||
return True, " Le compte intranet du client a été correctement crée"
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
@ -1446,6 +1446,8 @@ def partner_login(diction):
|
|||
tokenfield['token'] = str(my_token)
|
||||
tokenfield['type'] = 'partner'
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Insertion du nouveau token
|
||||
'''
|
||||
|
@ -1486,7 +1488,7 @@ def partner_login(diction):
|
|||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de récupérer les données de l'utilisateur (2)")
|
||||
return False, " Impossible de récupérer les données de l'utilisateur (2) "
|
||||
|
||||
list_connexion_context = {}
|
||||
list_connexion_context = []
|
||||
if( "list_connexion_context" in ret_val.keys() ):
|
||||
list_connexion_context = ret_val['list_connexion_context']
|
||||
|
||||
|
|
|
@ -4467,9 +4467,9 @@ def daterange(start_date, end_date):
|
|||
|
||||
|
||||
"""
|
||||
Cette fonction retroune un document paramétré dans le collection 'courrier_template'
|
||||
Cette fonction retourne un document paramétré dans le collection 'courrier_template'
|
||||
pour un partenaire donné.
|
||||
Si aucun, alors le sytème renvoie le document par defaut de MySy
|
||||
Si aucun, alors le système renvoie le document par defaut de MySy
|
||||
"""
|
||||
def Get_Personnalized_Document_From_courrier_template(diction):
|
||||
try:
|
||||
|
@ -4636,6 +4636,8 @@ def clean_session_dates():
|
|||
|
||||
"""
|
||||
Cette fonction retourne les champs a utiliser pour les template de document/
|
||||
|
||||
/!\ : Les tables en paramettres contiennent des valeurs du type ObjectId("idddd")
|
||||
Cette fonction retour un json de ce type :
|
||||
|
||||
convention_dictionnary_data =
|
||||
|
@ -4646,7 +4648,7 @@ convention_dictionnary_data =
|
|||
{'list_session_data':{....}}
|
||||
{'list_stagiaire_data':[{...}]}
|
||||
{'list_apprenant_data':[{...}]}
|
||||
{'client_data':{'raison_sociale':'xxx', 'nom':'yyy', list_contact_communication[{'civilite':'aa', 'nom':'bbb', ....'telephone_mobile':'01222'}, {'civilite':'aa', 'nom':'bbb', ....'telephone_mobile':'01222'} .... ]}
|
||||
{'list_client_data':{'raison_sociale':'xxx', 'nom':'yyy', list_contact_communication[{'civilite':'aa', 'nom':'bbb', ....'telephone_mobile':'01222'}, {'civilite':'aa', 'nom':'bbb', ....'telephone_mobile':'01222'} .... ]}
|
||||
{'systeme':{'date_jour':'11/02/2023'}}
|
||||
|
||||
}
|
||||
|
@ -5013,6 +5015,8 @@ def Get_Dictionnary_data_For_Template(diction):
|
|||
'invoice_email', 'invoice_nom', 'invoice_siret', 'invoice_adresse', 'invoice_ville', 'invoice_code_postal',
|
||||
'invoice_pays']
|
||||
|
||||
|
||||
|
||||
for client_data in MYSY_GV.dbname['partner_client'].find({'_id': {'$in': tab_client_id, },
|
||||
'valide': '1',
|
||||
'partner_recid': str(my_partner['recid'])
|
||||
|
@ -6576,8 +6580,6 @@ def Get_Partner_Data_From_Subdomain(diction):
|
|||
user['catalog_pub_message_2_gras'] = config_partner_catalog_data['message_2_gras']
|
||||
|
||||
|
||||
|
||||
|
||||
user['catalog_pub_message_3_txt'] = ""
|
||||
if (config_partner_catalog_data and "message_3_txt" in config_partner_catalog_data.keys()):
|
||||
user['catalog_pub_message_3_txt'] = config_partner_catalog_data['message_3_txt']
|
||||
|
@ -6663,6 +6665,16 @@ def Get_Partner_Data_From_Subdomain(diction):
|
|||
if (config_partner_catalog_data and "indicateur_4_taille" in config_partner_catalog_data.keys()):
|
||||
user['catalog_pub_indicateur_4_taille'] = config_partner_catalog_data['indicateur_4_taille']
|
||||
|
||||
# les contacts publics
|
||||
user['catalog_pub_contact_public_email'] = ""
|
||||
if (config_partner_catalog_data and "contact_public_email" in config_partner_catalog_data.keys()):
|
||||
user['catalog_pub_contact_public_email'] = config_partner_catalog_data['contact_public_email']
|
||||
|
||||
user['catalog_pub_contact_public_telephone'] = ""
|
||||
if (config_partner_catalog_data and "contact_public_telephone" in config_partner_catalog_data.keys()):
|
||||
user['catalog_pub_contact_public_telephone'] = config_partner_catalog_data['contact_public_telephone']
|
||||
|
||||
|
||||
|
||||
#-----------
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ def login(diction):
|
|||
for val in incom_keys:
|
||||
if str(val).lower() not in str(field_list).lower():
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" Le champ '" + val + "' n'existe pas, MAJ annulée")
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique"
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
|
@ -62,7 +62,7 @@ def login(diction):
|
|||
for val in field_list_obligatoire:
|
||||
if str(val).lower() not in diction:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" La valeur '" + val + "' n'est pas presente dans liste ")
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique"
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False
|
||||
|
||||
query = {}
|
||||
# recuperation des paramettre
|
||||
|
@ -84,7 +84,7 @@ def login(diction):
|
|||
coll_name = MYSY_GV.dbname['user_account']
|
||||
|
||||
|
||||
print(" on recherche ici " + email)
|
||||
#print(" on recherche ici " + email)
|
||||
|
||||
# Verification si ce user existe (controle : login et passwd)
|
||||
|
||||
|
@ -93,14 +93,19 @@ def login(diction):
|
|||
|
||||
if (tmp != 1):
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" Login/mot de passe invalide " + str(query)+ " my_user.count() = "+str(tmp))
|
||||
return False, " Login/mot de passe invalide, merci de verifier votre saisie. "
|
||||
return False, " Login/mot de passe invalide, merci de verifier votre saisie. ", False
|
||||
|
||||
my_user = coll_name.find(query)
|
||||
|
||||
#recuperation du recid du user
|
||||
user_recid = my_user[0]['recid']
|
||||
|
||||
print("#### user_recid = "+user_recid)
|
||||
user_firstconnexion = ""
|
||||
if( "firstconnexion" in my_user[0].keys() ):
|
||||
user_firstconnexion = my_user[0]['firstconnexion']
|
||||
|
||||
|
||||
#print("#### user_recid = "+user_recid)
|
||||
# A ce niveau le login et passe sont ok.
|
||||
# il faut donc créer le token et renvoyer le token.
|
||||
my_token = create_token_urlsafe()
|
||||
|
@ -142,6 +147,7 @@ def login(diction):
|
|||
"""
|
||||
partner_update_data = {}
|
||||
partner_update_data['lastconnexion'] = str(datetime.now())
|
||||
partner_update_data['firstconnexion'] = "0"
|
||||
partner_update_data['token'] = str(my_token)
|
||||
|
||||
|
||||
|
@ -149,6 +155,8 @@ def login(diction):
|
|||
|
||||
# Verification que les informations sont juste
|
||||
coll_name = MYSY_GV.dbname['user_account']
|
||||
|
||||
|
||||
ret_val = coll_name.find_one_and_update(
|
||||
{'email': str(email), 'pwd': str(pwd), 'active': '1', 'locked': '0'},
|
||||
{"$set": partner_update_data},
|
||||
|
@ -159,16 +167,16 @@ def login(diction):
|
|||
if ("_id" not in ret_val.keys()):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " Impossible de récupérer les données de l'utilisateur (2)")
|
||||
return False, " Impossible de récupérer les données de l'utilisateur (2) "
|
||||
return False, " Impossible de récupérer les données de l'utilisateur (2) ", False
|
||||
|
||||
|
||||
return True, str(my_token)
|
||||
return True, str(my_token), str(user_firstconnexion)
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" Impossible d'enregistrer le token " + my_token)
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique"
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de se connecter, merci de contacter le support technique"
|
||||
return False, "Impossible de se connecter, merci de contacter le support technique", False
|
Loading…
Reference in New Issue