61 lines
2.5 KiB
PHP
61 lines
2.5 KiB
PHP
|
<?php
|
||
|
include_once(__DIR__."/../../core.php");
|
||
|
|
||
|
// Decido la lunghezza minima della password, e la lunghezza minima del nome utente
|
||
|
$min_length = 8;
|
||
|
$min_length_username = 4;
|
||
|
$idgruppo = intval(filter('idgruppo'));
|
||
|
$idutente = intval(filter('idutente'));
|
||
|
$rs = $dbo->fetchArray("SELECT username , chiave_mobile FROM zz_utenti WHERE idutente='".$idutente."'" );
|
||
|
|
||
|
echo '
|
||
|
<form id="link_form" action="' . $rootdir . '/editor.php?id_module=' . $modules_info['Utenti e permessi']['id'] . '&id_record=' . $idgruppo . '" method="post">
|
||
|
<input type="hidden" name="op" value="change_pwd">
|
||
|
<input type="hidden" name="backto" value="record-edit">
|
||
|
<input type="hidden" name="min_length" value="' . $min_length . '">
|
||
|
<input type="hidden" name="min_length_username" value="' . $min_length_username . '">
|
||
|
|
||
|
<div class="row">
|
||
|
<div class="col-xs-12">
|
||
|
{[ "type": "text", "label": "' . _("Username") . '", "name": "username", "required": 1, "class": "", "value": "'.$rs[0]['username'].'", "extra": "" ]}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="row">
|
||
|
<div class="col-xs-12">
|
||
|
{[ "type": "password", "label": "' . _("Password") . '", "name": "password1", "required": 1, "class": "", "value": "", "extra": "" ]}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="row">
|
||
|
<div class="col-xs-12">
|
||
|
{[ "type": "password", "label": "' . _("Ripeti la password") . '", "name": "password2", "required": 0, "class": "", "value": "", "extra": "" ]}
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<div class="col-xs-12">
|
||
|
{[ "type": "spin", "label": "Chiave Mobile", "name": "username", "required": 0, "class": "", "value": "'.$rs[0]['chiave_mobile'].'", "extra": "" ]}
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<button type="button" onclick="do_submit()" class="btn btn-primary"><i class="fa fa-plus"></i> '._("Modifica").'</button>
|
||
|
</form>
|
||
|
<script type="text/javascript">
|
||
|
var min_length = ' . $min_length . ';
|
||
|
var min_length_username = ' . $min_length_username . ';
|
||
|
function do_submit(){
|
||
|
if( $(\'#password1\').val()==\'\' || $(\'#password2\').val()==\'\' )
|
||
|
alert( "Inserire una password valida." );
|
||
|
else if( $(\'#password1\').val() != $(\'#password2\').val() )
|
||
|
alert( "Le password non coincidono." );
|
||
|
else if( $(\'#password1\').val().length < min_length )
|
||
|
alert( "La password deve essere lunga minimo "+min_length+" caratteri!" );
|
||
|
else if( $(\'#username\').val().length < min_length_username )
|
||
|
alert( "Username deve essere lungo minimo "+min_length_username+" caratteri!" );
|
||
|
else
|
||
|
$(\'#link_form\').submit();
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<script src="' . $rootdir . '/lib/init.js"></script>';
|
||
|
?>
|