merge verifmobi
This commit is contained in:
commit
83f29c9b7d
8 changed files with 215 additions and 21 deletions
|
@ -44,3 +44,8 @@ $GLOBALS['comptespip_editer'] = [
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
if (test_plugin_actif('verifmob')) {
|
||||||
|
$GLOBALS['formulaires_verif_mobile'][] = 'editer_compte_spip';
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#CACHE{0}
|
#CACHE{0}
|
||||||
|
|
||||||
[(#SESSION{id_auteur}|sinon_interdire_acces{[(#URL_PAGE{mon_compte})]})]
|
[(#SESSION{id_auteur}|sinon_interdire_acces{[(#URL_PAGE{mon_compte})]})]
|
||||||
<div class="inner">
|
<div class="inner se_connecter">
|
||||||
<h1><:comptespip:editer_compte_spip:></h1>
|
<h3 class="comptespip_titre_form"><i class="fa fa-pencil fas fa-pen"></i> <:comptespip:editer_compte_spip:></h3>
|
||||||
<div class="pasAJAX">
|
<div class="pasAJAX">
|
||||||
[(#FORMULAIRE_EDITER_COMPTE_SPIP{#ENV{id_auteur}, #ENV{redirect}})]
|
[(#FORMULAIRE_EDITER_COMPTE_SPIP{#ENV{id_auteur}, #ENV{redirect}})]
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
#CACHE{0}
|
#CACHE{0}
|
||||||
[(#SESSION{id_auteur}|non|sinon_interdire_acces{#URL_SITE_SPIP})]
|
|
||||||
[(#CONFIG{comptespip/desactiver_page_connect}|non|sinon_interdire_acces{#URL_SITE_SPIP})]
|
[(#CONFIG{comptespip/desactiver_page_connect}|non|sinon_interdire_acces{#URL_SITE_SPIP})]
|
||||||
|
|
||||||
|
[(#SET{url_red,#CONFIG{comptespip/page_redirection_connexion}})]
|
||||||
|
[(#GET{url_red}|oui) #SET{url_red,#URL_PAGE{#GET{url_red}}} ]
|
||||||
|
[(#GET{url_red}|non) #URL_SITE_SPIP ]
|
||||||
|
[(#SESSION{id_auteur}|non|sinon_interdire_acces{#GET{url_red}})]
|
||||||
|
|
||||||
<div id="connect" class="inner">
|
<div id="connect" class="inner">
|
||||||
<B_presentation>
|
<B_presentation>
|
||||||
<div class="presentation">
|
<div class="presentation">
|
||||||
|
@ -16,14 +21,16 @@
|
||||||
|
|
||||||
<div class="se_connecter inner">
|
<div class="se_connecter inner">
|
||||||
<div class="grid-2 has-gutter-l">
|
<div class="grid-2 has-gutter-l">
|
||||||
<div class="sinscrire">
|
|
||||||
<h3 class="mlm"><:comptespip:sinscrire:></h3>
|
|
||||||
[(#FORMULAIRE_EDITER_COMPTE_SPIP{})]
|
|
||||||
</div>
|
|
||||||
<div class="login">
|
<div class="login">
|
||||||
<h3 class="mlm"><:comptespip:se_connecter:></h3>
|
<h3 class="comptespip_titre_form mlm"><i class="fa fa-unlock"></i> <:comptespip:se_connecter:></h3>
|
||||||
[(#FORMULAIRE_LOGIN{#URL_PAGE{#CONFIG{comptespip/page_redirection_connexion}}})]
|
[(#FORMULAIRE_LOGIN{#URL_PAGE{#CONFIG{comptespip/page_redirection_connexion}}})]
|
||||||
</div>
|
</div>
|
||||||
|
<div class="sinscrire">
|
||||||
|
<h3 class="comptespip_titre_form mlm"><i class="fa fa-user-plus"></i> <:comptespip:sinscrire:></h3>
|
||||||
|
<div class="PasAjax">
|
||||||
|
[(#FORMULAIRE_EDITER_COMPTE_SPIP{})]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #212529;
|
||||||
|
background-color: rgb(145, 144, 144);
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.badge::before {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding-top: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.comptespip_logo_auteur {
|
.comptespip_logo_auteur {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -5,3 +20,63 @@
|
||||||
.formulaire_spip .comptespip_logo_auteur .editer_logo {
|
.formulaire_spip .comptespip_logo_auteur .editer_logo {
|
||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.formulaire_editer_compte_spip legend {
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
.formulaire_editer_compte_spip label {
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
.formulaire_editer_compte_spip button {
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
.formulaire_editer_compte_spip a {
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
.formulaire_editer_compte_spip a.supprimer_compte_spip {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.se_connecter .formulaire_spip {
|
||||||
|
background-color: rgba(235, 235, 235, 1) !important;
|
||||||
|
}
|
||||||
|
.se_connecter .boutons {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
.se_connecter fieldset {
|
||||||
|
background-color: transparent !important;
|
||||||
|
border: 1px solid rgb(0, 0, 0);
|
||||||
|
padding: 0 3rem 1rem;
|
||||||
|
margin: 1rem 0;
|
||||||
|
}
|
||||||
|
.se_connecter legend {
|
||||||
|
width: auto;
|
||||||
|
padding: 0 1.5rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
letter-spacing: initial;
|
||||||
|
font-variant: small-caps;
|
||||||
|
}
|
||||||
|
.se_connecter #indicatif {
|
||||||
|
width: 2rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.se_connecter .verif_mobile {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
}
|
||||||
|
@media (min-width: 980px) {
|
||||||
|
.se_connecter div.sinscrire {
|
||||||
|
order: -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.comptespip_titre_form {
|
||||||
|
margin-bottom: -3rem;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
margin-left: 2rem;
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,25 @@
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<h3 class="legend"><:comptespip:conf_formulaire_inscription:></h3>
|
<h3 class="legend"><:comptespip:conf_formulaire_inscription:></h3>
|
||||||
|
[(#PLUGIN{verifmob}|oui)
|
||||||
|
<div class="editer_groupe">
|
||||||
|
#SET{name,login_telephone}
|
||||||
|
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
|
||||||
|
<div class="editer editer_[(#GET{name})][ (#GET{erreurs}|oui)erreur]">
|
||||||
|
<label>Le login = le telephone</label>
|
||||||
|
<div class="choix">
|
||||||
|
<input type="radio" class="radio" name="#GET{name}" value="" id="#GET{name}_non"[ (#ENV{#GET{name}}|non|?{checked="checked"})] >
|
||||||
|
<label for="#GET{name}_non">Non</label>
|
||||||
|
</div>
|
||||||
|
<div class="choix">
|
||||||
|
<input type="radio" class="radio" name="#GET{name}" value="oui" id="#GET{name}_oui"[ (#ENV{#GET{name}}|=={oui}|?{checked="checked"})] >
|
||||||
|
<label for="#GET{name}_oui">Oui</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
<div class="editer_groupe">
|
<div class="editer_groupe">
|
||||||
#SET{name,id_presentation}
|
#SET{name,id_presentation}
|
||||||
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
|
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
|
||||||
|
|
|
@ -31,6 +31,54 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="editer_groupe">
|
||||||
|
<BOUCLE_con(CONDITION){si #PLUGIN{verifmob}|oui}>
|
||||||
|
<style type="text/css" media="screen">
|
||||||
|
.editer_telephone {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<fieldset>
|
||||||
|
<legend><:comptespip:telephone|ucfirst:></legend>
|
||||||
|
<div class="editer">
|
||||||
|
#SET{erreurs,#ENV**{erreurs}|table_valeur{mobile}}
|
||||||
|
[<span class="erreur_message">(#GET{erreurs})</span>]
|
||||||
|
<div class="verif_mobile editer">
|
||||||
|
<div class="indicateur_plus">
|
||||||
|
<span class="badge toto"><i class="fa fa-plus"></i></span>
|
||||||
|
</div>
|
||||||
|
<input class="text" type="text"
|
||||||
|
name="indicatif"
|
||||||
|
id="indicatif"
|
||||||
|
value="#ENV{indicatif}"
|
||||||
|
pattern="[0-9]{2,4}"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<input type="tel" class="verif_mobile"
|
||||||
|
id="mobile"
|
||||||
|
name="mobile"
|
||||||
|
placeholder="611223344"
|
||||||
|
value="[(#ENV{mobile})]"
|
||||||
|
pattern="^[67][0-9]{8}$"
|
||||||
|
autocomplete="off"
|
||||||
|
required
|
||||||
|
maxlength="9"
|
||||||
|
>
|
||||||
|
<button class="btn--warning envoyer_sms mts mlm" type="button"><:gabo:envoyer_sms:></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='editer saisie_confirmation obligatoire[ (#ENV*{erreurs}|table_valeur{confirmation}|oui)erreur]'>
|
||||||
|
<label for="confirmation"><:comptespip:code_confirmation_sms:> <em class="obligatoire"><:info_obligatoire_02:></em></label>
|
||||||
|
#SET{erreurs,#ENV**{erreurs}|table_valeur{confirmation_sms}}
|
||||||
|
[<span class="erreur_message">(#GET{erreurs})</span>]
|
||||||
|
<input type="text" class="text" id="confirmation_sms" name="confirmation_sms" value="#ENV{confirmation_sms}">
|
||||||
|
</div>
|
||||||
|
<button class="btn btn--warning renvoyer_sms" type="button"> <:comptespip:renvoyer_sms:> </button>
|
||||||
|
</fieldset>
|
||||||
|
[(#INCLURE{fond=inclure/verif_mobile})]
|
||||||
|
</BOUCLE_con>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="editer_groupe">
|
<div class="editer_groupe">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><:comptespip:mot_de_passe:></legend>
|
<legend><:comptespip:mot_de_passe:></legend>
|
||||||
|
@ -71,8 +119,8 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
jQuery(function(){
|
jQuery(function(){
|
||||||
|
setTimeout(()=> $('#champ_password_confirmation').val(''), 400);
|
||||||
jQuery('form#editer_compte_spip').on('submit', function(e){
|
jQuery('form#editer_compte_spip').on('submit', function(e){
|
||||||
//var alea = "#ENV{alea}";
|
|
||||||
['#champ_password', "#champ_password_confirmation"].forEach((champ)=>{
|
['#champ_password', "#champ_password_confirmation"].forEach((champ)=>{
|
||||||
var pass = $(champ).val();
|
var pass = $(champ).val();
|
||||||
$(champ).val('');
|
$(champ).val('');
|
||||||
|
@ -82,7 +130,6 @@
|
||||||
&& !pass.match(/^\{([0-9a-f]{64});([0-9a-f]{64});([0-9a-f]{32});([0-9a-f]{32})\}$/i)
|
&& !pass.match(/^\{([0-9a-f]{64});([0-9a-f]{64});([0-9a-f]{32});([0-9a-f]{32})\}$/i)
|
||||||
&& sha256_self_test() // verifions que le hash sha est operationnel
|
&& sha256_self_test() // verifions que le hash sha est operationnel
|
||||||
) {
|
) {
|
||||||
//var hash = hex_sha256(alea + pass);
|
|
||||||
var hash = hex_sha256(pass);
|
var hash = hex_sha256(pass);
|
||||||
if ( hash ) {
|
if ( hash ) {
|
||||||
if (champ === "#champ_password") {
|
if (champ === "#champ_password") {
|
||||||
|
|
|
@ -18,6 +18,17 @@ function formulaires_editer_compte_spip_charger_dist($id_auteur = 'new', $redir
|
||||||
$valeurs['_bigup_rechercher_fichiers'] = 'true';
|
$valeurs['_bigup_rechercher_fichiers'] = 'true';
|
||||||
$valeurs['logo'] = '';
|
$valeurs['logo'] = '';
|
||||||
}
|
}
|
||||||
|
if (test_plugin_actif('verifmob') and isset($valeurs['telephone'])) {
|
||||||
|
$valeurs['mobile'] = substr($valeurs['telephone'],1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (test_plugin_actif('verifmob')) {
|
||||||
|
$valeurs['mobile'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (test_plugin_actif('verifmob')) {
|
||||||
|
$valeurs['indicatif'] = '33';
|
||||||
|
$valeurs['confirmation_sms'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$valeurs['alea'] = '';
|
$valeurs['alea'] = '';
|
||||||
|
@ -108,6 +119,17 @@ function formulaires_editer_compte_spip_verifier_dist($id_auteur = 'new', $redi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// si verif mobile, unicite du login (telephone)
|
||||||
|
if (test_plugin_actif('verifmob')) {
|
||||||
|
$tel = '0' . _request('mobile');
|
||||||
|
$test = sql_countsel('spip_auteurs', [
|
||||||
|
'login='.sql_quote($tel),
|
||||||
|
'id_auteur!='.intval($id_auteur)
|
||||||
|
]);
|
||||||
|
if ($test) {
|
||||||
|
$erreurs['mobile'] = _T('comptespip:telephone_deja_enregistre');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $erreurs;
|
return $erreurs;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +141,11 @@ function formulaires_editer_compte_spip_traiter_dist($id_auteur = 'new', $redir
|
||||||
$mode = lire_config('comptespip/statut');
|
$mode = lire_config('comptespip/statut');
|
||||||
$retour = [];
|
$retour = [];
|
||||||
|
|
||||||
|
if (test_plugin_actif('verifmob')) {
|
||||||
|
$tel = '0' . _request('mobile');
|
||||||
|
set_request('telephone', $tel);
|
||||||
|
}
|
||||||
|
|
||||||
include_spip('action/editer_auteur');
|
include_spip('action/editer_auteur');
|
||||||
include_spip('inc/acces');
|
include_spip('inc/acces');
|
||||||
|
|
||||||
|
@ -127,13 +154,22 @@ function formulaires_editer_compte_spip_traiter_dist($id_auteur = 'new', $redir
|
||||||
$update = true;
|
$update = true;
|
||||||
$set = [];
|
$set = [];
|
||||||
if (!intval($id_auteur)) {
|
if (!intval($id_auteur)) {
|
||||||
|
if (function_exists('comptespip_associer_auteur')) {
|
||||||
|
$id_auteur = comptespip_associer_auteur();
|
||||||
|
} else {
|
||||||
$id_auteur = auteur_inserer();
|
$id_auteur = auteur_inserer();
|
||||||
|
}
|
||||||
$update = false;
|
$update = false;
|
||||||
|
|
||||||
|
if (lire_config('comptespip/login_telephone') === 'oui') {
|
||||||
|
$login = _request('telephone');
|
||||||
|
} else {
|
||||||
// $search = [ ' ', "'", 'é' ];
|
// $search = [ ' ', "'", 'é' ];
|
||||||
// $replace = [ '_', '_', 'e' ];
|
// $replace = [ '_', '_', 'e' ];
|
||||||
// $login = strtolower(str_replace($search, $replace, _request('nom')));
|
// $login = strtolower(str_replace($search, $replace, _request('nom')));
|
||||||
// $login .= '_'.$id_auteur;
|
// $login .= '_'.$id_auteur;
|
||||||
$login = 'login_'.$id_auteur;
|
$login = 'login_'.$id_auteur;
|
||||||
|
}
|
||||||
$set['login'] = $login;
|
$set['login'] = $login;
|
||||||
$set['statut'] = $mode;
|
$set['statut'] = $mode;
|
||||||
if (strlen($password) < 50) {
|
if (strlen($password) < 50) {
|
||||||
|
@ -186,6 +222,9 @@ function formulaires_editer_compte_spip_traiter_dist($id_auteur = 'new', $redir
|
||||||
$set['alea_futur'] = creer_uniqid();
|
$set['alea_futur'] = creer_uniqid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lire_config('comptespip/login_telephone') === 'oui') {
|
||||||
|
$set['login'] = _request('telephone');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($saisies)) {
|
if (!empty($saisies)) {
|
||||||
|
|
|
@ -73,4 +73,6 @@ $GLOBALS[$GLOBALS['idx_lang']] = array(
|
||||||
|
|
||||||
// T
|
// T
|
||||||
'titre_page_configurer_comptespip' => 'CompteSPIP',
|
'titre_page_configurer_comptespip' => 'CompteSPIP',
|
||||||
|
'telephone_deja_enregistre' => "Ce téléphone est déjà présent",
|
||||||
|
'telephone' => 'téléphone',
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue