|
|
|
@ -13,37 +13,36 @@ define('forum/login', ['csrf', 'translator'], function(csrf, translator) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
if (!$('#username').val() || !$('#password').val()) {
|
|
|
|
|
translator.translate('[[error:invalid-username-or-password]]', function(translated) {
|
|
|
|
|
errorEl.find('p').text(translated);
|
|
|
|
|
errorEl.show();
|
|
|
|
|
});
|
|
|
|
|
errorEl.find('p').translateText('[[error:invalid-username-or-password]]');
|
|
|
|
|
errorEl.show();
|
|
|
|
|
} else {
|
|
|
|
|
errorEl.hide();
|
|
|
|
|
|
|
|
|
|
if (!submitEl.hasClass('disabled')) {
|
|
|
|
|
submitEl.addClass('disabled');
|
|
|
|
|
formEl.ajaxSubmit({
|
|
|
|
|
headers: {
|
|
|
|
|
'x-csrf-token': csrf.get()
|
|
|
|
|
},
|
|
|
|
|
success: function(data, status) {
|
|
|
|
|
window.location.href = data;
|
|
|
|
|
},
|
|
|
|
|
error: function(data, status) {
|
|
|
|
|
translator.translate(data.responseText, config.defaultLang, function(translated) {
|
|
|
|
|
errorEl.find('p').text(translated);
|
|
|
|
|
errorEl.show();
|
|
|
|
|
submitEl.removeClass('disabled');
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (submitEl.hasClass('disabled')) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
submitEl.addClass('disabled');
|
|
|
|
|
formEl.ajaxSubmit({
|
|
|
|
|
headers: {
|
|
|
|
|
'x-csrf-token': csrf.get()
|
|
|
|
|
},
|
|
|
|
|
success: function(data, status) {
|
|
|
|
|
window.location.href = data;
|
|
|
|
|
},
|
|
|
|
|
error: function(data, status) {
|
|
|
|
|
errorEl.find('p').translateText(data.responseText);
|
|
|
|
|
errorEl.show();
|
|
|
|
|
submitEl.removeClass('disabled');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#login-error-notify button').on('click', function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
errorEl.hide();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#content #username').focus();
|
|
|
|
|