parent
fd83cb0884
commit
50a262c665
|
|
@ -6,20 +6,12 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="c6d0259a-16e1-410d-91a1-830590ee2a08" name="Changes" comment="13/12/25 - 14h">
|
||||
<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$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.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$/Session_Formation.py" beforeDir="false" afterPath="$PROJECT_DIR$/Session_Formation.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/attached_file_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/attached_file_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/competence.py" beforeDir="false" afterPath="$PROJECT_DIR$/competence.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_queu/email_queu_mgt.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/internal_email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/internal_email_mgt.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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/partner_invoice.py" beforeDir="false" afterPath="$PROJECT_DIR$/partner_invoice.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/survey_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/survey_mgt.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" />
|
||||
|
|
@ -462,7 +454,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1747251650255</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="519" />
|
||||
<option name="localTasksCounter" value="520" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
|
|
|||
4032
Log/log_file.log
4032
Log/log_file.log
File diff suppressed because one or more lines are too long
|
|
@ -791,8 +791,8 @@ def Update_SessionFormation_Only_Step(diction):
|
|||
|
||||
if( is_valide_session != 1 ):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - L'identifiant de La promotion de formation est invalide ")
|
||||
return False, "L'identifiant de La promotion de formation est invalide"
|
||||
str(inspect.stack()[0][3]) + " - L'identifiant de la session / promotion de formation est invalide ")
|
||||
return False, "L'identifiant de la session/promotion de formation est invalide"
|
||||
|
||||
|
||||
is_valide_session_data = MYSY_GV.dbname['session_formation'].find_one({'_id': ObjectId(str(diction['_id'])),
|
||||
|
|
@ -800,6 +800,7 @@ def Update_SessionFormation_Only_Step(diction):
|
|||
'partner_owner_recid': str(
|
||||
my_partner['recid'])})
|
||||
|
||||
"""
|
||||
if( "invoiced_statut" in is_valide_session_data.keys() and is_valide_session_data['invoiced_statut'] == '1'):
|
||||
mycommon.myprint(
|
||||
str(inspect.stack()[0][3]) + " - Cette session est partiellement facturée. Impossible de modifier l'étape ")
|
||||
|
|
@ -810,7 +811,7 @@ def Update_SessionFormation_Only_Step(diction):
|
|||
str(inspect.stack()[0][
|
||||
3]) + " - Cette session est complètement facturée. Impossible de modifier l'étape ")
|
||||
return False, "Cette session est complètement facturée. Impossible de modifier l'étape"
|
||||
|
||||
"""
|
||||
|
||||
new_data = {}
|
||||
|
||||
|
|
|
|||
|
|
@ -879,6 +879,11 @@ def change_user_pwd(diction):
|
|||
mycommon.myprint(" La valeur '" + val + "' n'est pas presente dans la liste des arguments ")
|
||||
return False, " Impossible de mettre à jour le mot de passe"
|
||||
|
||||
local_status, my_partner = mycommon.Check_Connexion_And_Return_Partner_Data({'token': str(diction['token'])})
|
||||
if (local_status is not True):
|
||||
return local_status, my_partner
|
||||
|
||||
print(" ### my_partner == ", my_partner)
|
||||
|
||||
# recuperation des paramettre
|
||||
email_value = ""
|
||||
|
|
@ -944,8 +949,8 @@ def change_user_pwd(diction):
|
|||
|
||||
coll_name = MYSY_GV.dbname['user_account']
|
||||
|
||||
#print(" le recid = "+user_recid+" mydata = "+str(mydata))
|
||||
ret_val = coll_name.find_one_and_update({'recid': user_recid, 'locked': '0', 'active':'1', 'pwd':pwd},
|
||||
|
||||
ret_val = coll_name.find_one_and_update({'_id':my_partner['_id'], 'locked': '0', 'active':'1', 'pwd':pwd},
|
||||
{"$set": mydata},
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
|
|
|||
17
main.py
17
main.py
|
|
@ -209,6 +209,23 @@ def login():
|
|||
return jsonify(status=status, message=retval, firstconnexion=firstconnexion)
|
||||
|
||||
|
||||
|
||||
'''
|
||||
cette API gere le login et la creation du token pour l'intranet client
|
||||
'''
|
||||
@app.route('/myclass/api/login_intranet_client/', methods=['POST','GET'])
|
||||
@crossdomain(origin='*')
|
||||
def login_intranet_client():
|
||||
# On recupere le corps (payload) de la requete
|
||||
payload = mycommon.strip_dictionary (request.form.to_dict())
|
||||
print(" ### login_intranet_client payload = ",payload)
|
||||
status, retval, firstconnexion, _id = us.login_intranet_client(payload)
|
||||
return jsonify(status=status, message=retval, firstconnexion=firstconnexion, _id=_id)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
API - Ent_Student gere le login et la creation du token pour l'espace ENT
|
||||
'''
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ def Record_Survey_Data_No_Token(diction):
|
|||
local_diction['session_id'] = str(survey_data['session_id'])
|
||||
local_diction['survey_type'] = str(survey_data['_id'])
|
||||
local_diction['formulaire_id'] = str(survey_data['formulaire_id'])
|
||||
if( "inscription_id" in survey_data.keys() and survey_data['survey_data']):
|
||||
if( "inscription_id" in survey_data.keys() and survey_data['inscription_id']):
|
||||
local_diction['inscription_id'] = str(survey_data['inscription_id'])
|
||||
|
||||
if ("client_id" in survey_data.keys() and survey_data['client_id']):
|
||||
|
|
@ -557,7 +557,7 @@ def Record_Survey_Data_No_Token(diction):
|
|||
local_diction['partner_owner_recid'] = str(survey_data['partner_owner_recid'])
|
||||
local_diction['survey_type'] = str(survey_data['survey_type'])
|
||||
|
||||
if( "inscription_id" in local_diction.keys() and local_diction['local_diction']):
|
||||
if( "inscription_id" in local_diction.keys() and local_diction['inscription_id']):
|
||||
print(" ### local_diction = ", local_diction)
|
||||
retval_status, retval = Survey_Send_Notification_Sur_Seuil_Alert(local_diction)
|
||||
|
||||
|
|
|
|||
155
user_session.py
155
user_session.py
|
|
@ -187,6 +187,161 @@ def login(diction):
|
|||
return False, "Impossible de se connecter, merci de contacter le support technique", False
|
||||
|
||||
|
||||
"""
|
||||
Login d'un client de l'intranet
|
||||
"""
|
||||
def login_intranet_client(diction):
|
||||
try:
|
||||
# Dictionnaire des champs utilisables
|
||||
field_list = ['email', 'pwd', 'type']
|
||||
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'existe pas, MAJ annulée")
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False
|
||||
|
||||
'''
|
||||
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']
|
||||
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 la liste des arguments ")
|
||||
return False, " Impossible de se connecter, merci de contacter le support technique", False, False
|
||||
|
||||
query = {}
|
||||
# recuperation des paramettre
|
||||
if ("email" in diction.keys()):
|
||||
if diction['email']:
|
||||
email = diction['email']
|
||||
query['email'] = diction['email']
|
||||
|
||||
|
||||
if ("pwd" in diction.keys()):
|
||||
if diction['pwd']:
|
||||
pwd = diction['pwd']
|
||||
query['pwd'] = diction['pwd']
|
||||
|
||||
if ("type" in diction.keys()):
|
||||
if diction['type']:
|
||||
type = diction['type']
|
||||
query['type'] = diction['type']
|
||||
|
||||
query['active'] = '1'
|
||||
query['locked'] = '0'
|
||||
|
||||
# Recuperation du RecId du user connecté
|
||||
coll_name = MYSY_GV.dbname['user_account']
|
||||
|
||||
|
||||
#print(" on recherche ici " + email)
|
||||
|
||||
# Verification si ce user existe (controle : login et passwd)
|
||||
|
||||
|
||||
tmp = coll_name.count_documents(query)
|
||||
|
||||
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. ", False, False
|
||||
|
||||
my_user = coll_name.find(query)
|
||||
|
||||
#recuperation du recid du user
|
||||
user_recid = my_user[0]['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()
|
||||
|
||||
# Enregistrement du token
|
||||
token_collection = MYSY_GV.dbname['partner_token']
|
||||
|
||||
tokenfield = {}
|
||||
tokenfield['token'] = my_token
|
||||
tokenfield['email'] = email
|
||||
tokenfield['recid'] = user_recid
|
||||
tokenfield['date_update'] = str(datetime.now())
|
||||
tokenfield['start_date'] = str(datetime.now())
|
||||
tokenfield['valide'] = '1'
|
||||
tokenfield['locked'] = '0'
|
||||
tokenfield['type'] = 'user'
|
||||
|
||||
|
||||
'''
|
||||
Si il y a un token en cours de validité, il est mis à jour pr prolonger la durée
|
||||
de vie du token
|
||||
s'il n'y a pas de token valide, aloes on insert un.
|
||||
'''
|
||||
ret_val = token_collection.find_one_and_update({'recid': str(user_recid), 'valide': '1'},
|
||||
{"$set": tokenfield},
|
||||
upsert=True,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
|
||||
if ret_val and ret_val['_id']:
|
||||
mycommon.myprint(" Ajout Token OK, _id = "+str(ret_val['_id']))
|
||||
|
||||
now = str(datetime.now())
|
||||
|
||||
"""
|
||||
Mise à jour du compte du partenaie
|
||||
avec les info de last connexion et de token
|
||||
"""
|
||||
partner_update_data = {}
|
||||
partner_update_data['lastconnexion'] = str(datetime.now())
|
||||
partner_update_data['firstconnexion'] = "0"
|
||||
partner_update_data['token'] = str(my_token)
|
||||
|
||||
|
||||
partner_key_secrete_key = ""
|
||||
|
||||
# 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},
|
||||
upsert=False,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
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) ", False, False
|
||||
|
||||
|
||||
return True, str(my_token), str(user_firstconnexion), str(ret_val['_id'])
|
||||
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", False, 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", False, False
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Lorsqu'un user se logue, on recupere son RecId,
|
||||
|
|
|
|||
Loading…
Reference in New Issue