Merge branch 'master' into develop

isekai-main
Barış Soner Uşaklı 1 year ago
commit 81961255f1

@ -11,10 +11,11 @@ define('forum/login', ['hooks', 'translator', 'jquery-form'], function (hooks, t
const submitEl = $('#login'); const submitEl = $('#login');
const formEl = $('#login-form'); const formEl = $('#login-form');
submitEl.on('click', function (e) { submitEl.on('click', async function (e) {
e.preventDefault(); e.preventDefault();
const username = $('#username').val();
if (!$('#username').val() || !$('#password').val()) { const password = $('#password').val();
if (!username || !password) {
errorEl.find('p').translateText('[[error:invalid-username-or-password]]'); errorEl.find('p').translateText('[[error:invalid-username-or-password]]');
errorEl.show(); errorEl.show();
} else { } else {
@ -26,6 +27,23 @@ define('forum/login', ['hooks', 'translator', 'jquery-form'], function (hooks, t
submitEl.addClass('disabled'); submitEl.addClass('disabled');
try {
const hookData = await hooks.fire('filter:app.login', {
username,
password,
cancel: false,
});
if (hookData.cancel) {
submitEl.removeClass('disabled');
return;
}
} catch (err) {
errorEl.find('p').translateText(err.message);
errorEl.show();
submitEl.removeClass('disabled');
return;
}
hooks.fire('action:app.login'); hooks.fire('action:app.login');
formEl.ajaxSubmit({ formEl.ajaxSubmit({
headers: { headers: {

Loading…
Cancel
Save