mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 17:05:51 +01:00
closed #2424
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
/* global define, app, RELATIVE_PATH */
|
||||
|
||||
define('forum/login', function() {
|
||||
define('forum/login', ['csrf'], function(csrf) {
|
||||
var Login = {};
|
||||
|
||||
Login.init = function() {
|
||||
@@ -14,7 +14,7 @@ define('forum/login', function() {
|
||||
|
||||
if (!$('#username').val() || !$('#password').val()) {
|
||||
translator.translate('[[error:invalid-username-or-password]]', function(translated) {
|
||||
errorEl.find('p').text(translated)
|
||||
errorEl.find('p').text(translated);
|
||||
errorEl.show();
|
||||
});
|
||||
} else {
|
||||
@@ -22,7 +22,21 @@ define('forum/login', function() {
|
||||
|
||||
if (!submitEl.hasClass('disabled')) {
|
||||
submitEl.addClass('disabled');
|
||||
formEl.submit();
|
||||
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');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user