forked from mirrors/easyappointments
Login works again using the new login HTTP client.
This commit is contained in:
parent
af464bd83c
commit
3c0f925596
2 changed files with 5 additions and 9 deletions
|
@ -50,7 +50,7 @@
|
|||
|
||||
<script src="<?= asset_url('assets/vendor/@fortawesome-fontawesome-free/fontawesome.min.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/vendor/@fortawesome-fontawesome-free/solid.min.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/js/utils/general_functions.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/js/http/login_http_client.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/js/pages/login.js') ?>"></script>
|
||||
|
||||
<?php section('scripts') ?>
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue