23/03/23 - 16h

master
cherif 2023-03-23 15:54:04 +01:00
parent 861cbfd6b3
commit 9d998e6e36
10 changed files with 1874 additions and 66 deletions

View File

@ -4,8 +4,14 @@
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="21/03/23 - 22h"> <list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="21/03/23 - 22h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Template/MySy_Create_PRO_account_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_Create_PRO_account_tpl.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Template/MySy_account_pro_enabled_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/MySy_account_pro_enabled_tpl.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" beforeDir="false" afterPath="$PROJECT_DIR$/lms_chamilo/mysy_lms.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/strype_payement.py" beforeDir="false" afterPath="$PROJECT_DIR$/strype_payement.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.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" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

File diff suppressed because one or more lines are too long

View File

@ -65,7 +65,7 @@
<tr> <tr>
<td bgcolor="#ffffff" height="165" style="height:165px; padding: 0.7rem;" width="600"> <td bgcolor="#ffffff" height="165" style="height:165px; padding: 0.7rem;" width="600">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" <table border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff"
style="background-color:#ffffff"> style="background-color:#ffffff">
<tbody> <tbody>
<tr> <tr>
<td align="center" height="165" <td align="center" height="165"
@ -83,17 +83,22 @@
<p> Bonjour {{ params.user_name }}</p> <p> Bonjour {{ params.user_name }}</p>
<p style="text-align:justify"> <p style="text-align:justify">
<p style="text-align:justify"> <p style="text-align:justify;font-size:12px">
Vous avez fait une demande de création d'un compte Vous avez fait une demande de création d'un compte
professionnel sur mysy-training.com.</p> professionnel sur mysy-training.com.</p>
<p style="text-align:justify">La sécurité de vos données <p style="text-align:justify;font-size:12px">Après l'activation de
est primordiale pour nous. Une fois que vous aurez votre compte, vous allez recevoir <u><font color="red">
activé votre compte vous allez recevoir <font une clé secrète </font></u>
color="red"> une clé secrète </font> nécessaire nécessaire pour la saisie et la modification de vos
pour vous connecter.</p> modes de payement.<br />
<p style="text-align:justify">Pour activer votre compte, Seules les personnes autorisées à utiliser vos
moyens de payement doivent connaitre cette clé.
</p>
<p style="text-align:justify;font-size:12px">Pour activer votre compte,
veuillez cliquer sur le lien ci-dessous. </p> veuillez cliquer sur le lien ci-dessous. </p>
</p> </p>
@ -107,18 +112,13 @@
</a> </a>
<p style="text-align:justify"> <p style="text-align:justify">
<p
style="text-align:justify; color: red; text-decoration: underline;"> &nbsp;
Important </p>
<p style="text-align:justify">
Pour vous connecter entant que professionnel sur le
site mysy-training.com, la clé secrète et le mot de
passe sont nécessaires.</p>
</p> </p>
<p <p
style="font-size:x-small;margin-top: 1rem; line-height: normal; margin-bottom: 1rem;"> style="font-size:12px;margin-top: 1rem; line-height: normal; margin-bottom: 1rem;">
Cordialement<br /> Cordialement<br />
MySy Training Technology<br /> MySy Training Technology<br />
Contact : +337 69 20 39 45<br /> Contact : +337 69 20 39 45<br />
@ -162,7 +162,7 @@
Training 1 Cr du Havre, 75008 Paris ou par mail : Training 1 Cr du Havre, 75008 Paris ou par mail :
contact@mysy-training.com. contact@mysy-training.com.
<br /> <br />
</p> </p>
</div> </div>

View File

@ -65,7 +65,7 @@
<tr> <tr>
<td bgcolor="#ffffff" height="165" style="height:165px; padding: 0.7rem;" width="600"> <td bgcolor="#ffffff" height="165" style="height:165px; padding: 0.7rem;" width="600">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" <table border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff"
style="background-color:#ffffff"> style="background-color:#ffffff">
<tbody> <tbody>
<tr> <tr>
@ -84,10 +84,10 @@
<p> Bonjour {{ params.user_name }}</p> <p> Bonjour {{ params.user_name }}</p>
<p style="text-align:justify"> <p style="text-align:justify">
<p style="text-align:justify"> <p style="text-align:justify;font-size:12px">
Vous venez d'activer votre compte professionnel sur Vous venez d'activer votre compte professionnel sur
le moteur de recherche MySy-Training. Tout s'est le site MySy-training.com Tout s'est
bien déroulé. bien déroulé.
</p> </p>
<table border="0" cellpadding="0" cellspacing="0"> <table border="0" cellpadding="0" cellspacing="0">
@ -104,20 +104,22 @@
</tbody> </tbody>
</table> </table>
<p style="text-align:justify"> <p style="text-align:justify;font-size:12px">
Vous pouvez dès à présent vous connecter à l'aide de Vous pouvez dès à présent vous connecter à l'aide de
votre email, mot de passe et votre <font votre email et votre mot de passe.<br />
color="red"> clé secrète </font> pour utiliser Conservez votre <font color="red"> clé secrète
les services proposés par MySy.</p> </font> pour la gestion de vos modes de paiement.
</p>
<p style="text-align:justify">Votre clé secrète est : {{ <p style="text-align:justify;font-size:12px">Votre clé
params.secrete }}<br />url de connexion : secrète est : {{
https://www.mysy-training.com/PartnerLogin </p> params.secrete }}<br />
Rendez-vous sur le site <a href="https://www.mysy-training.com/"> https://www.mysy-training.com/ </a> pour vous connecter</p>
</p> </p>
<p <p
style="font-size:x-small;margin-top: 1rem; line-height: normal;margin-bottom: 1rem;"> style="font-size:12px;margin-top: 1rem; line-height: normal;margin-bottom: 1rem;">
Cordialement<br /> Cordialement<br />
MySy Training Technology<br /> MySy Training Technology<br />
Contact : +337 69 20 39 45<br /> Contact : +337 69 20 39 45<br />
@ -161,7 +163,7 @@
Training 1 Cr du Havre, 75008 Paris ou par mail : Training 1 Cr du Havre, 75008 Paris ou par mail :
contact@mysy-training.com. contact@mysy-training.com.
<br /> <br />
</p> </p>
</div> </div>

View File

@ -1,3 +1,4 @@
,index,mots,occurence,moyenne,id_formation,source_field ,index,mots,occurence,moyenne,id_formation,source_field
0,0,developpement,1,0.5,5Disc_0008,title 0,0,praticien,1,0.33,MYSY_Test_AR,title
1,1,personnel,1,0.5,5Disc_0008,title 1,1,aromatherapie,1,0.33,MYSY_Test_AR,title
2,2,integrative,1,0.33,MYSY_Test_AR,title

1 index mots occurence moyenne id_formation source_field
2 0 0 developpement praticien 1 0.5 0.33 5Disc_0008 MYSY_Test_AR title
3 1 1 personnel aromatherapie 1 0.5 0.33 5Disc_0008 MYSY_Test_AR title
4 2 2 integrative 1 0.33 MYSY_Test_AR title

View File

@ -1,3 +1,4 @@
mots occurence moyenne id_formation source_field mots occurence moyenne id_formation source_field
0 developpement 1 0.5 5Disc_0008 title 0 praticien 1 0.33 MYSY_Test_AR title
1 personnel 1 0.5 5Disc_0008 title 1 aromatherapie 1 0.33 MYSY_Test_AR title
2 integrative 1 0.33 MYSY_Test_AR title

View File

@ -166,39 +166,73 @@ def Create_MySy_LMS_User(diction):
for username, email_canonical in cur: for username, email_canonical in cur:
print(f"username: {username}, email_canonical : {email_canonical}") print(f"username: {username}, email_canonical : {email_canonical}")
""" """
# Verification d'abord si le compte exite.
query_compte_exist = " Select count(*), user_id From user WHERE username = '"+username+"' "
print(" ### query_compte_exist = ", query_compte_exist)
query_compte_exist_exec = cur.execute(query_compte_exist)
# insert information query_compte_exist_exec = ""
my_query = "INSERT INTO user SET id='"+str(new_lms_user_id)+"' , " \ query_compte_exist_exec_val = "0"
"user_id='"+str(new_lms_user_id)+"' , " \ for query_compte_exist_exec in cur:
"lastname = '"+lastname+"', " \ query_compte_exist_exec_val = query_compte_exist_exec[0]
"firstname = '"+firstname+"', " \ new_lms_user_id = query_compte_exist_exec[1]
"username = '"+username+"', " \ conn.commit()
"salt = '"+str(salt)+"'," \
" registration_date = '"+registration_date+"'," \
" credentials_expired='0', " \ if( int(mycommon.tryInt(query_compte_exist_exec_val)) > 0 ):
"enabled='1', " \ # Le compte existe, il faut donc faire une mise à jour
"expired='0', " \ my_query = "UPDATE user SET salt = '" + str(salt) + "', credentials_expired='0', " \
"created_at='" + str( registration_date) + "'," \ "updated_at='" + str(registration_date) + " ', " \
" updated_at='" + str( registration_date) + "', " \ "password = '" + str(
" status = '1', " \ hashed_pwd) + "', " \
"password = '"+str(hashed_pwd)+"', " \ "enabled='1', " \
"locked = '0', " \ "expired='0', " \
"username_canonical = '"+username+"', " \ "locked = '0', " \
" email_canonical = '"+email+"', " \ "auth_source = 'platform'," \
"email = '"+email+"'," \ "roles = 'a:0:{}', " \
" official_code = '"+official_code+"', " \ "language = 'french'," \
"creator_id = '1', " \ "username_canonical = '" + username + "', " \
"auth_source = 'platform'," \ " email_canonical = '" + email + "', " \
"roles = 'a:0:{}', " \ "email = '" + email + "'," \
"language = 'french'," \ " official_code = '" + official_code + "', " \
"active = '1';" "active = '1' WHERE username='" + str(
email) + "' ;"
else:
# Le compte n'existe pas, il faut le créer
# insert information
my_query = "INSERT INTO user SET id='"+str(new_lms_user_id)+"' , " \
"user_id='"+str(new_lms_user_id)+"' , " \
"lastname = '"+lastname+"', " \
"firstname = '"+firstname+"', " \
"username = '"+username+"', " \
"salt = '"+str(salt)+"'," \
" registration_date = '"+registration_date+"'," \
" credentials_expired='0', " \
"enabled='1', " \
"expired='0', " \
"created_at='" + str( registration_date) + "'," \
" updated_at='" + str( registration_date) + "', " \
" status = '1', " \
"password = '"+str(hashed_pwd)+"', " \
"locked = '0', " \
"username_canonical = '"+username+"', " \
" email_canonical = '"+email+"', " \
"email = '"+email+"'," \
" official_code = '"+official_code+"', " \
"creator_id = '1', " \
"auth_source = 'platform'," \
"roles = 'a:0:{}', " \
"language = 'french'," \
"active = '1';"
try: try:
#print(" ### my_query = ", my_query) print(" ### my_query = ", my_query)
#cur.execute("INSERT INTO employees (first_name,last_name) VALUES (?, ?)", ("Maria", "DB")) #cur.execute("INSERT INTO employees (first_name,last_name) VALUES (?, ?)", ("Maria", "DB"))
cur.execute(my_query) cur.execute(my_query)
except mariadb.Error as e: except mariadb.Error as e:
print(f"Error: {e}") #print(f"Error: {e}")
mycommon.myprint(" Impossible de créer l'utilisateur LMS "+str({e})) mycommon.myprint(" Impossible de créer l'utilisateur LMS "+str({e}))
return False, "Impossible de créer l'utilisateur LMS "+str({e}), False return False, "Impossible de créer l'utilisateur LMS "+str({e}), False
@ -218,7 +252,7 @@ def Create_MySy_LMS_User(diction):
new_dicton = {} new_dicton = {}
new_dicton['token'] = my_token new_dicton['token'] = my_token
new_dicton['lms_user_id'] = str(cur.lastrowid) new_dicton['lms_user_id'] = str(new_lms_user_id)
new_dicton['mysy_pack'] = my_partner['pack_service'] new_dicton['mysy_pack'] = my_partner['pack_service']
new_dicton['mysy_nb_formation'] = my_partner['nb_formation'] new_dicton['mysy_nb_formation'] = my_partner['nb_formation']
@ -243,7 +277,7 @@ def Create_MySy_LMS_User(diction):
) )
return True, " Creation du compte LMS OK. l'id = "+str(lastrowid), str(lastrowid) return True, " Creation du compte LMS OK. l'id = "+str(new_lms_user_id), str(new_lms_user_id)
except Exception as e: except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info() exc_type, exc_obj, exc_tb = sys.exc_info()

12
main.py
View File

@ -1579,6 +1579,18 @@ def removeLSaccount():
return jsonify(status=status, message=message) return jsonify(status=status, message=message)
"""
API de suppression du compte de Nicole"""
@app.route('/myclass/api/removeNBaccount/', methods=['GET','POST'])
@crossdomain(origin='*')
def removeNBaccount():
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### removeNBaccount payload = ", str(payload))
status, message = mycommon.removeNBaccount()
return jsonify(status=status, message=message)
""" """
Pour des test, et seulement pour les test Pour des test, et seulement pour les test
cette fonction permet de mettre les formation du user "ls" cette fonction permet de mettre les formation du user "ls"

View File

@ -187,12 +187,12 @@ def add_partner_account(diction):
ret_val = coll_name.insert_one(mydata) ret_val = coll_name.insert_one(mydata)
mail.send_partner_account_mail(ret_val.inserted_id, str(mydata['email'])) mail.send_partner_account_mail(ret_val.inserted_id, str(mydata['email']))
return True, " Le partenaire a été créé" return True, "Le compte utilisateur a été correctement créé. Vous allez recevoir un email avec les informations de connexion."
except Exception as e: except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info() 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)) mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False, "Impossible de créer le partenaire" return False, "Impossible de créer le compte utilisateur"

View File

@ -2272,6 +2272,23 @@ def removeLSaccount():
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno)) print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False return False
"""
Suppression du compte de Nicole"""
def removeNBaccount():
try:
coll = MYSY_GV.dbname["partnair_account"]
myquery = {"email": "nicole.beauchesne@hotmail.fr"}
x = coll.delete_many(myquery)
print(x.deleted_count, " documents deleted.")
return True, str(x.deleted_count) + " documents deleted."
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
print(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False
""" """
Cette fonction verifier si une url est une image. Cette fonction verifier si une url est une image.
elle permet si besoin de verifier la taille de l'image elle permet si besoin de verifier la taille de l'image