From 3c0f9255969065e93dffd9ca32b9889bfe05877a Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Mon, 17 Jan 2022 18:22:59 +0100 Subject: [PATCH] Login works again using the new login HTTP client. --- application/views/pages/login.php | 2 +- assets/js/pages/login.js | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/application/views/pages/login.php b/application/views/pages/login.php index 7f60e10d..b5767f4c 100644 --- a/application/views/pages/login.php +++ b/application/views/pages/login.php @@ -50,7 +50,7 @@ - + diff --git a/assets/js/pages/login.js b/assets/js/pages/login.js index c26cff97..a50ae713 100644 --- a/assets/js/pages/login.js +++ b/assets/js/pages/login.js @@ -23,24 +23,20 @@ App.Pages.Login = (function () { * Login Button "Click" * * Make an ajax call to the server and check whether the user's credentials are right. + * * If yes then redirect him to his desired page, otherwise display a message. */ function onLoginFormSubmit(event) { event.preventDefault(); - const url = App.Vars.baseUrl + '/index.php/login/validate'; - - const data = { - csrf_token: App.Vars.csrf_token, - username: $username.val(), - password: $password.val() - }; + const username = $username.val(); + const password = $password.val(); const $alert = $('.alert'); $alert.addClass('d-none'); - $.post(url, data).done((response) => { + App.Http.Login.validate(username, password).done((response) => { if (response.success) { window.location.href = App.Vars.dest_url; } else {