Validation 26/02/22 - 12h20

master
ChérifBALDE 2022-02-26 12:45:54 +01:00 committed by cherif
parent 72529bc82b
commit ae22379cbf
3 changed files with 8842 additions and 8 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1002,8 +1002,6 @@ def get_partner_class(diction):
def get_class_global_search(search_string):
try:
mycommon.myprint(" search_string", search_string)

View File

@ -21,6 +21,7 @@ from datetime import datetime
import prj_common as mycommon
from pymongo import ReturnDocument
import inspect
import sys, os
class JSONEncoder(json.JSONEncoder):
@ -450,7 +451,8 @@ def update_user_account(diction):
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
# field_list.
'''
field_list = ['adr_street', 'adr_city', 'adr_zip', 'adr_country', 'mob_phone','link_facebook', 'link_twitter', 'token']
field_list = ['adr_street', 'adr_city', 'adr_zip', 'adr_country', 'mob_phone','link_facebook',
'link_twitter', 'token', 'surname', 'last_name', 'birthday']
incom_keys=diction.keys()
for val in incom_keys:
if val not in field_list:
@ -515,17 +517,29 @@ def update_user_account(diction):
if (str(diction['email'])):
myemail = str(diction['email'])
if ("surname" in diction.keys()):
if (str(diction['surname'])):
mysurname = str(diction['surname'])
if ("last_name" in diction.keys()):
if (str(diction['last_name'])):
mylast_name = str(diction['last_name'])
if ("birthday" in diction.keys()):
if (str(diction['birthday'])):
mybirthday = str(diction['birthday'])
# Verification de la validité du token/mail dans le cas des user en mode connecté
if ( len(str(mytoken)) <= 0):
mycommon.myprint("Le token est vide")
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token est vide")
return False, "Impossible de mettre à jour le compte utilisateur"
retval = mycommon.check_token_validity(myemail, mytoken)
if retval is False:
mycommon.myprint("L'email ou le token ne sont pas valident")
mycommon.myprint(str(inspect.stack()[0][3]) + " -L'email ou le token ne sont pas valident")
return False, "L'email ou le token ne sont pas valident"
@ -548,7 +562,7 @@ def update_user_account(diction):
user_recid = mycommon.get_user_recid_from_token(str(mytoken))
if user_recid is False :
mycommon.myprint("Impossible de recuperer le user_recid")
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le user_recid")
return False, "Impossible de mettre à jour le compte utilisateur"
@ -558,10 +572,10 @@ def update_user_account(diction):
)
if (ret_val and ret_val['_id']):
mycommon.myprint("La modif a bien ete faite =" + str(ret_val['_id']))
mycommon.myprint(str(inspect.stack()[0][3]) + " -La modif a bien ete faite =" + str(ret_val['_id']))
return True, " Le compte utilisateur a bien ete mis à jour"
else:
mycommon.myprint(" Aucune modif n'a été faite")
mycommon.myprint(str(inspect.stack()[0][3]) + " - Aucune modif n'a été faite")
return False, "Impossible de mettre à jour le compte utilisateur"
except Exception as e: