mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
doing some reshuffling in public/src
public/src/admin and public/src/client; also some cleanup in src/meta/js, no need to filter out admin files anymore
This commit is contained in:
39
public/src/client/login.js
Normal file
39
public/src/client/login.js
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
/* global define, app, RELATIVE_PATH */
|
||||
|
||||
define('forum/login', function() {
|
||||
var Login = {};
|
||||
|
||||
Login.init = function() {
|
||||
var errorEl = $('#login-error-notify'),
|
||||
submitEl = $('#login'),
|
||||
formEl = $('#login-form');
|
||||
|
||||
submitEl.on('click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!$('#username').val() || !$('#password').val()) {
|
||||
translator.translate('[[error:invalid-username-or-password]]', function(translated) {
|
||||
errorEl.find('p').text(translated)
|
||||
errorEl.show();
|
||||
});
|
||||
} else {
|
||||
errorEl.hide();
|
||||
|
||||
if (!submitEl.hasClass('disabled')) {
|
||||
submitEl.addClass('disabled');
|
||||
formEl.submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#login-error-notify button').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
errorEl.hide();
|
||||
});
|
||||
|
||||
$('#content #username').focus();
|
||||
};
|
||||
|
||||
return Login;
|
||||
});
|
||||
Reference in New Issue
Block a user