[+] BO : login and lost password is now in ajax and convert in AdminController

This commit is contained in:
vAugagneur committed 2011-11-23 21:32:11 +00:00
1 parent 5ea63af72c
commit 059331511a
11 files changed
+765 -263

No files matched your search

+104
View File
@@ -0,0 +1,104 @@
$(document).ready(function(){
if (document.getElementById('email'))
document.getElementById('email').focus();
});
function displayForgotPassword()
{
$('#error').hide();
$("#login").flip({
direction:'tb',
color : '#FFF',
content: $('#forgot_password')
})
}
function doAjaxLogin()
{
$('#error').hide();
$('#ajax-loader').fadeIn('slow', function () {
$.ajax({
type:"POST",
url: "ajax-tab.php",
async: true,
dataType: "json",
data : {
ajax: "1",
token: "",
controller: "AdminLogin",
submitLogin: "1",
passwd : $('#passwd').val(),
email : $('#email').val()
},
success : function(jsonData)
{
if (jsonData.hasErrors)
{
displayErrors(jsonData.errors);
$('#login').effect("shake", { times:3 }, 300);
}
else
{
window.location.href = jsonData.redirect;
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$('#error').html('<h3>TECHNICAL ERROR:</h3><p>Details: Error thrown: ' + XMLHttpRequest + '</p><p>Text status: ' + textStatus + '</p>');
$('#error').fadeIn();
$('#ajax-loader').fadeOut('slow');
}
});
});
}
function doAjaxForgot()
{
$('#error').hide();
$('#ajax-loader').fadeIn('slow', function () {
$.ajax({
type:"POST",
url: "ajax-tab.php",
async: true,
dataType: "json",
data : {
ajax: "1",
token: "",
controller: "AdminLogin",
submitForgot: "1",
email_forgot: $('#email_forgot').val()
},
success : function(jsonData)
{
if (jsonData.hasErrors)
{
displayErrors(jsonData.errors);
$('#login').effect("shake", { times:3 }, 300);
}
else
{
window.location.href = jsonData.redirect;
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$('#error').html('<h3>TECHNICAL ERROR:</h3><p>Details: Error thrown: ' + XMLHttpRequest + '</p><p>Text status: ' + textStatus + '</p>');
$('#error').fadeIn();
$('#ajax-loader').fadeOut('slow');
}
});
});
}
function displayErrors(errors)
{
str_errors = '<h3>'+(errors.length > 1 ? there_are : there_is )+' '+errors.length+' '+(errors.length > 1 ? label_errors : label_error )+'</h3><ol>';
for(error in errors)
//IE6 bug fix
if(error != 'indexOf')
str_errors += '<li>'+errors[error] + '</li>';
$('#ajax-loader').fadeOut('slow');
$('#error').html(str_errors+'</ol>');
$('#error').fadeIn();
}