update 25/02/2022 - 13h00
parent
ae22379cbf
commit
3fe6ff7ee2
27295
Log/log_file.log
27295
Log/log_file.log
File diff suppressed because it is too large
Load Diff
31
class_mgt.py
31
class_mgt.py
|
@ -82,14 +82,14 @@ def add_class(diction):
|
|||
CONCERNANT LES CREEES PAR NOS SYSTEME AUTOMATIQUE, IL FAUDRA LEUR PASSER UNE VALEUR MALGRE TOUT
|
||||
|
||||
'''
|
||||
retval = mycommon.check_token_validity("", str(mydata['token']))
|
||||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token ne sont pas valident")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(str(mydata['token']))
|
||||
# Recuperation du recid du partenaire
|
||||
user_recid = mycommon.get_parnter_recid_from_token(str(mydata['token']))
|
||||
if user_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid de l'utilisateur")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
@ -240,14 +240,14 @@ def update_class(diction):
|
|||
CONCERNANT CELLES CREEES PAR NOS SYSTEME AUTOMATIQUE, IL FAUDRA LEUR PASSER UNE VALEUR MALGRE TOUT
|
||||
|
||||
'''
|
||||
retval = mycommon.check_token_validity("", str(mydata['token']))
|
||||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token ne sont pas valident")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(str(mydata['token']))
|
||||
user_recid = mycommon.get_parnter_recid_from_token(str(mydata['token']))
|
||||
if user_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid de l'utilisateur")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
@ -398,14 +398,14 @@ def disable_class(diction):
|
|||
CONCERNANT CELLES CREEES PAR NOS SYSTEME AUTOMATIQUE, IL FAUDRA LEUR PASSER UNE VALEUR MALGRE TOUT
|
||||
|
||||
'''
|
||||
retval = mycommon.check_token_validity("", str(mydata['token']))
|
||||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token ne sont pas valident")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(str(mydata['token']))
|
||||
user_recid = mycommon.get_parnter_recid_from_token(str(mydata['token']))
|
||||
if user_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid de l'utilisateur")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
@ -501,14 +501,14 @@ def enable_class(diction):
|
|||
CONCERNANT CELLES CREEES PAR NOS SYSTEME AUTOMATIQUE, IL FAUDRA LEUR PASSER UNE VALEUR MALGRE TOUT
|
||||
|
||||
'''
|
||||
retval = mycommon.check_token_validity("", str(mydata['token']))
|
||||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token ne sont pas valident")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(str(mydata['token']))
|
||||
user_recid = mycommon.get_parnter_recid_from_token(str(mydata['token']))
|
||||
if user_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid de l'utilisateur")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
@ -599,14 +599,14 @@ def unlock_class(diction):
|
|||
CONCERNANT CELLES CREEES PAR NOS SYSTEME AUTOMATIQUE, IL FAUDRA LEUR PASSER UNE VALEUR MALGRE TOUT
|
||||
|
||||
'''
|
||||
retval = mycommon.check_token_validity("", str(mydata['token']))
|
||||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token ne sont pas valident")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(str(mydata['token']))
|
||||
user_recid = mycommon.get_parnter_recid_from_token(str(mydata['token']))
|
||||
if user_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid de l'utilisateur")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
@ -703,14 +703,14 @@ def lock_class(diction):
|
|||
CONCERNANT CELLES CREEES PAR NOS SYSTEME AUTOMATIQUE, IL FAUDRA LEUR PASSER UNE VALEUR MALGRE TOUT
|
||||
|
||||
'''
|
||||
retval = mycommon.check_token_validity("", str(mydata['token']))
|
||||
retval = mycommon.check_partner_token_validity("", str(mydata['token']))
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token ne sont pas valident")
|
||||
return False, "L'email ou le token ne sont pas valident"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(str(mydata['token']))
|
||||
user_recid = mycommon.get_parnter_recid_from_token(str(mydata['token']))
|
||||
if user_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de recuperer le recid de l'utilisateur")
|
||||
return False, " Les informations d'identification sont incorrectes"
|
||||
|
@ -953,14 +953,14 @@ def get_partner_class(diction):
|
|||
user_recid = "None"
|
||||
# Verification de la validité du token/mail dans le cas des user en mode connecté
|
||||
if (len(str(my_token)) > 0):
|
||||
retval = mycommon.check_token_validity("", my_token)
|
||||
retval = mycommon.check_partner_token_validity("", my_token)
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint( str(inspect.stack()[0][3])+" - Le token n'est pas valide")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
||||
# Recuperation du recid de l'utilisateur
|
||||
user_recid = mycommon.get_user_recid_from_token(my_token)
|
||||
user_recid = mycommon.get_parnter_recid_from_token(my_token)
|
||||
if user_recid is False:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+" - Impossible de recuperer le token de l'utilisateur")
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
@ -1001,7 +1001,6 @@ def get_partner_class(diction):
|
|||
|
||||
|
||||
|
||||
|
||||
def get_class_global_search(search_string):
|
||||
try:
|
||||
mycommon.myprint(" search_string", search_string)
|
||||
|
|
19
main.py
19
main.py
|
@ -744,6 +744,25 @@ def add_class_mass():
|
|||
|
||||
|
||||
|
||||
'''
|
||||
Cette API gere la connexion d'un partenaire.
|
||||
|
||||
Pour memo la connexion d'un partenaire est differente de celle d'un user
|
||||
Pour le partenaire, en plud du mail, passwd, il faut fournir le token qui est "secrete"
|
||||
'''
|
||||
@app.route('/myclass/api/partner_login/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def partner_login():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = request.form.to_dict()
|
||||
print(" ### payload = ",payload)
|
||||
print(request.files)
|
||||
status, retval = pa.partner_login(payload)
|
||||
return jsonify(status=status, message=retval)
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(" debut api")
|
||||
|
||||
|
|
138
partners.py
138
partners.py
|
@ -24,6 +24,10 @@ from datetime import datetime
|
|||
import logging
|
||||
import prj_common as mycommon
|
||||
import secrets
|
||||
import inspect
|
||||
import sys, os
|
||||
from pymongo import ReturnDocument
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
|
||||
|
@ -56,7 +60,7 @@ def add_partner_account(diction):
|
|||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint(" Creation partner account : Le champ '" + val + "' n'existe pas, Creation partenaire annulée")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Creation partner account : Le champ '" + val + "' n'existe pas, Creation partenaire annulée")
|
||||
return False, "Impossible de créer le partenaire"
|
||||
|
||||
|
||||
|
@ -67,7 +71,7 @@ def add_partner_account(diction):
|
|||
field_list_obligatoire = ['nom', 'email','pwd', 'telephone','contact_nom','contact_prenom','contact_tel','contact_mail']
|
||||
for val in field_list_obligatoire :
|
||||
if val not in diction:
|
||||
mycommon.myprint( " : 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"
|
||||
|
||||
# recuperation des paramettre
|
||||
|
@ -136,7 +140,7 @@ def add_partner_account(diction):
|
|||
tmp = coll_name.find({'email': str(mydata['email']) }).count()
|
||||
logging.info(" TMP = "+str(tmp))
|
||||
if( tmp > 0 ):
|
||||
mycommon.myprint("l'adresse email '"+str(mydata['email'])+"' existe deja, impossible de créer le compte partenaire ")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - l'adresse email '"+str(mydata['email'])+"' existe deja, impossible de créer le compte partenaire ")
|
||||
return False, "l'adresse email '"+str(mydata['email'])+"' existe deja, impossible de créer le compte partenaire "
|
||||
|
||||
ret_val = coll_name.insert_one(mydata)
|
||||
|
@ -144,7 +148,8 @@ def add_partner_account(diction):
|
|||
return True, " Le partenaire a été créé"
|
||||
|
||||
except Exception as e:
|
||||
mycommon.myprint(e)
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de créer le partenaire"
|
||||
|
||||
|
||||
|
@ -170,7 +175,7 @@ def update_partner_account(diction):
|
|||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint(" Creation partner account : Le champ '" + val + "' n'existe pas, Creation partenaire annulée")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Creation partner account : Le champ '" + val + "' n'existe pas, Creation partenaire annulée")
|
||||
return False, " Creation partner account : Le champ '" + val + "' n'existe pas, Creation partenaire annulée"
|
||||
|
||||
'''
|
||||
|
@ -180,7 +185,7 @@ def update_partner_account(diction):
|
|||
field_list_obligatoire = ['token']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(" 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, " La valeur '" + val + "' n'est pas presente dans liste "
|
||||
|
||||
# recuperation des paramettre
|
||||
|
@ -265,7 +270,8 @@ def update_partner_account(diction):
|
|||
return True, "Le partenaire a bien ete mise à jour"
|
||||
|
||||
except Exception as e:
|
||||
mycommon.myprint(e)
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de mettre à jour le partenaire"
|
||||
|
||||
|
||||
|
@ -313,11 +319,11 @@ def valide_partnair_account(value):
|
|||
|
||||
ret_val = token_collection.insert_one(tokenfield)
|
||||
if ret_val and ret_val.inserted_id:
|
||||
mycommon.myprint("Ajout Token OK, _id = " + str(ret_val.inserted_id))
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Ajout Token OK, _id = " + str(ret_val.inserted_id))
|
||||
return 'True', my_token
|
||||
|
||||
else:
|
||||
mycommon.myprint(" Impossible d'enregistrer le token " + my_token)
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible d'enregistrer le token " + my_token)
|
||||
return False, "Impossible de valider le compte"
|
||||
|
||||
else:
|
||||
|
@ -326,7 +332,8 @@ def valide_partnair_account(value):
|
|||
|
||||
|
||||
except Exception as e:
|
||||
mycommon.myprint( e)
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de valider le compte"
|
||||
|
||||
|
||||
|
@ -342,7 +349,7 @@ def get_partner_account(diction):
|
|||
incom_keys = diction.keys()
|
||||
for val in incom_keys:
|
||||
if val not in field_list:
|
||||
mycommon.myprint(" Le champ '" + val + "' n'existe pas, requete annulée")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le champ '" + val + "' n'existe pas, requete annulée")
|
||||
return False, " Impossible de recuperer les informations"
|
||||
|
||||
'''
|
||||
|
@ -352,7 +359,7 @@ def get_partner_account(diction):
|
|||
field_list_obligatoire = [ 'token']
|
||||
for val in field_list_obligatoire:
|
||||
if val not in diction:
|
||||
mycommon.myprint(" : 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 recuperer les informations"
|
||||
|
||||
# recuperation des paramettre
|
||||
|
@ -373,7 +380,7 @@ def get_partner_account(diction):
|
|||
retval = mycommon.check_token_validity(email_value, token_value )
|
||||
|
||||
if retval is False:
|
||||
mycommon.myprint("Le token n'est pas valide")
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " - Le token n'est pas valide")
|
||||
return False, " Impossible de recuperer les informations"
|
||||
|
||||
|
||||
|
@ -399,5 +406,108 @@ def get_partner_account(diction):
|
|||
return True, RetObject
|
||||
|
||||
except Exception as e:
|
||||
mycommon.myprint(e)
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer les informations"
|
||||
|
||||
|
||||
|
||||
'''
|
||||
|
||||
Login du partenaire avec
|
||||
- mail
|
||||
- passwd
|
||||
- cle secrete qui est son token fixe'''
|
||||
def partner_login(diction):
|
||||
try:
|
||||
|
||||
# Dictionnaire des champs utilisables
|
||||
field_list = ['email', 'pwd', 'secret']
|
||||
incom_keys = diction.keys()
|
||||
|
||||
'''
|
||||
# Verification que les champs reçus dans l'API sont bien dans la liste des champs autorisés
|
||||
# Cela evite le cas ou une entité tierce ajouter les valeurs inconnu dans l'API
|
||||
# Ici on doit mettre tous les champs possible (obligatoire ou non) de la BDD dans la liste
|
||||
# field_list.
|
||||
'''
|
||||
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'est pas accepté dans cette API")
|
||||
return False, " Impossible de se connecter"
|
||||
|
||||
'''
|
||||
Une fois qu'on a controlé que toutes les clés mise dans l'API sont correcte. etape precedente,
|
||||
On controle que les champs obligatoires sont presents dans la liste
|
||||
'''
|
||||
field_list_obligatoire = ['email', 'pwd', 'secret']
|
||||
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 des champs")
|
||||
return False, "Impossible de se connecter"
|
||||
|
||||
|
||||
mydata={}
|
||||
|
||||
# recuperation des paramettre
|
||||
if ("email" in diction.keys()):
|
||||
if diction['email']:
|
||||
email = diction['email']
|
||||
mydata['email'] = diction['email']
|
||||
|
||||
|
||||
if ("pwd" in diction.keys()):
|
||||
if diction['pwd']:
|
||||
pwd = diction['pwd']
|
||||
|
||||
|
||||
|
||||
if ("secret" in diction.keys()):
|
||||
if diction['secret']:
|
||||
token = diction['secret']
|
||||
mydata['token'] = diction['secret']
|
||||
|
||||
now = str(datetime.now())
|
||||
|
||||
mydata['valide'] = "1"
|
||||
mydata['date_update'] = now
|
||||
|
||||
|
||||
# Verification que les informations sont juste
|
||||
coll_name = dbname['partnair_account']
|
||||
ret_val = coll_name.find_one_and_update({'email': str(email), 'pwd': str(pwd), 'token': str(token), 'active': '1', 'locked':'0'},
|
||||
{"$set": {'last_connexion':str(now)}},
|
||||
upsert=True,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
if ret_val and ret_val['_id']:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Connexion partener "+email+" : OK, Date : "+ str(now)+" , _id = " + str(ret_val['_id']))
|
||||
# Vu que les credentials sont ok, alors enregistrement de la connexion dans la table "partner token"
|
||||
|
||||
mydata['recid'] = str(ret_val['recid'])
|
||||
token_collection = dbname['partner_token']
|
||||
|
||||
ret_val2 = token_collection.find_one_and_update({'recid': str(mydata['recid']), 'valide': '1', 'locked':'0'},
|
||||
{"$set": mydata},
|
||||
upsert=True,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
if ret_val2 and ret_val2['_id']:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Connexion partener_token : OK , _id = " + str(ret_val2['_id']))
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible d'enregistrer le token du partenare dans partener_token ")
|
||||
return False, " Impossible de se connecter"
|
||||
|
||||
|
||||
return True, " Partner Connexion : OK"
|
||||
else:
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Impossible de se connecter - Partner ")
|
||||
return False, " Impossible de se connecter"
|
||||
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, " Impossible de recuperer la formation"
|
||||
|
|
|
@ -10,6 +10,8 @@ from werkzeug.utils import secure_filename
|
|||
import time
|
||||
import os
|
||||
import csv
|
||||
import inspect
|
||||
import sys
|
||||
|
||||
TOKEN_SIZE = 25
|
||||
CONNECTION_STRING = "mongodb://localhost/cherifdb"
|
||||
|
@ -65,7 +67,8 @@ def Upload_Save_CSV_File(file=None, Folder=None):
|
|||
return True, Global_file_name
|
||||
|
||||
except Exception as e :
|
||||
myprint(str(inspect.stack()[0][3]) + " - " + str(e))
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, None
|
||||
|
||||
|
||||
|
@ -88,10 +91,39 @@ def check_token_validity(email="", token=""):
|
|||
return True
|
||||
|
||||
except Exception as e:
|
||||
myprint(e)
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Cette fonction prend un token
|
||||
puis verifie si la validité du trile (email, token, statut) EXCLUSIVEMENT PR LES PARTNER, d
|
||||
donc la table partner_token
|
||||
'''
|
||||
def check_partner_token_validity(email="", token=""):
|
||||
try :
|
||||
|
||||
coll_token = dbname['partner_token']
|
||||
tmp_count = coll_token.find(
|
||||
{ 'token': str(token), 'locked':'0', 'valide': '1'}).count()
|
||||
|
||||
if (tmp_count <= 0):
|
||||
myprint("Le token du partenaire n'est pas valide")
|
||||
return False
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False
|
||||
|
||||
|
||||
'''
|
||||
recuperation du recid du user
|
||||
'''
|
||||
def get_user_recid_from_token(token = ""):
|
||||
if len(str(token)) <= 0 :
|
||||
myprint(" Le token est vide")
|
||||
|
@ -102,6 +134,24 @@ def get_user_recid_from_token(token = ""):
|
|||
user_recid = tmp_val[0]['recid']
|
||||
return user_recid
|
||||
|
||||
|
||||
|
||||
'''
|
||||
recuperation du recid du partner
|
||||
'''
|
||||
def get_parnter_recid_from_token(token = ""):
|
||||
if len(str(token)) <= 0 :
|
||||
myprint(" Le token partner est vide")
|
||||
return False
|
||||
|
||||
coll_token = dbname['partner_token']
|
||||
tmp_val = coll_token.find({'token': str(token), 'valide': '1', 'locked':'0'})
|
||||
user_recid = tmp_val[0]['recid']
|
||||
return user_recid
|
||||
|
||||
|
||||
|
||||
|
||||
def get_user_recid_from_email(email = ""):
|
||||
if len(str(email)) <= 0 :
|
||||
myprint(" L'email est vide")
|
||||
|
|
|
@ -13,6 +13,7 @@ import logging
|
|||
import prj_common as mycommon
|
||||
from pymongo import ReturnDocument
|
||||
import inspect
|
||||
import sys, os
|
||||
|
||||
TOKEN_SIZE = 25
|
||||
CONNECTION_STRING = "mongodb://localhost/cherifdb"
|
||||
|
@ -80,7 +81,6 @@ def login(diction):
|
|||
|
||||
|
||||
# Recuperation du RecId du user connecté
|
||||
|
||||
coll_name = dbname['user_account']
|
||||
|
||||
|
||||
|
@ -133,5 +133,6 @@ def login(diction):
|
|||
|
||||
|
||||
except Exception as e:
|
||||
mycommon.myprint(str(inspect.stack()[0][3])+str(e))
|
||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
|
||||
return False, "Impossible de se connecter"
|
Loading…
Reference in New Issue