//$(function() {
// Bind the form
/* $('#login_module').submit(function(e) {
e.preventDefault();
var data = $(this).serializeArray();
var checkAll = true;
$.each(data, function(key, value) {
// Check value
data[key].value = value.value.trim();
if (value.value == '') {
checkAll = false;
$($('#login_module').find('input[name='+value.name+']')).addClass('error');
$('#error_div').remove();
$('#login_module').prepend('
Errore nei campi
');
}
else {
$('#error_div').remove();
$('#login_module').find('input[name='+value.name+']').removeClass('error');
data[key].value = encodeURI(value.value);
}
});
if (checkAll) {
// Proceed with login,
amatAPI.request('loginuser_module', {
'username_utente': data[0].value,
'password_utente': data[1].value,
'autologin':'No'
}, login_loginUser);
}
});
});
var login_loginUser = function(data) {
// if () return false;
//console.log(data);
if (typeof data[0]['User Login'] == "undefined") {
// Login failed
$('#error_div').remove();
$('#login_module').prepend('Si è verificato un errore
');
if (typeof data[0]['Stato Information'] != "undefined") alert(data[0]['Stato Information']['Info']);
}
else {
// Success
$.cookie("user_data", "uid="+data[0]['User Login']['UID']+"&groupid="+data[0]['User Login']['GROUPUID']+"&flag="+data[0]['User Login']['Flag']+"&name="+data[0]['User Login']['Name']+"&UTCLI_id="+data[0]['User Login']['UTCLI_id']);
window.location.href = "index.html";
}
return true;
}*/
function openForm(){
$('#forgotpassword').toggle();
}
function resetPassword(){
if ($('#t_1').val().trim()=="" || $('#t_3').val().trim()==""){
$('#t_1').addClass('error');$('#t_3').addClass('error');
alert('I campi Username e Email sono obbligatori');
return;
}
if (confirm('Confermando questa operazione riceverai \nsulla casella Email associata alla tua registrazione \nuna nuova password assegnata dal sistema. \n\n Vuoi proseguire con questa operazione?'))
$.post(siteurl+'/user/resetUserPassword',{'username':$('#t_1').val(),'email':$('#t_3').val()},holdReset);
}
var holdReset = function(data,extext){
// alert(data);
data = $.parseJSON(data);
if (typeof data == "undefined") {alert('Si è verificato un errore');return false;}
// if (typeof data[0]['Stato User Information'] != "undefined" && data[0]['Stato User Information']['Stato']=='Success') {
if (typeof data[0]['Stato User Information'] != "undefined" && data[0]['Stato User Information']['Stato']=='Success') {
alert(data[0]['Stato User Information']['Info']);
} else {alert('Si è verificato un errore:\n'+data[0]['Stato User Information']['Info']);return false;}
}
//});//close function generic