jeudi 10 novembre 2022

CSRF token mismatched in laravel when i moved project to another server

enter image description here

Hii My website is not working on other server code is same into both server

1, Working server

http://programmingly.com/articles/

  • testuser@gmail.com
  • 12345678 (Working perfect)

https://www.vennocracy.com/

  • testuser@gmail.com
  • 12345678 (Not Working)

I tried ajax for that

$('#login-form').validate({
        rules: {
            email: {
                required: true,
            },
            password: {
                required: true,
            },
        },
        messages: {
            email: {
                required: 'Please enter email',
            },
            password: {
                required: 'Please enter password',
            },
        },
        submitHandler: function(form) {
            $.ajax({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                url: "",
                type: "POST",
                data: new FormData(form),
                dataType: 'json',
                contentType: false,
                cache: false,
                processData: false,
                beforeSend: function() {
                    $("body").append(
                        "<div class='ajax-overlay'><i class='porto-loading-icon'></i></div>"
                        );
                },
                success: function(res) {
                    $(".ajax-overlay").remove();
                    if (res.status) {
                        $('.all-error').html('');
                        $('.all-success').html('');
                        $('.all-success').html(res.message);
                        setTimeout(function() {
                            $("#loginModal").modal('hide');
                            location.reload();
                        }, 4000);
                    } else {
                        $('.all-error').html('');
                        $('.all-error').html(res.message);
                    }
                },
                error: function(data) {
                    $(".ajax-overlay").remove();
                    var errorString = '';
                    $.each(data.responseJSON.errors, function(key, value) {
                        errorString += value + '<br>';
                    });
                    $('.all-error').html('');
                    $('.all-success').html('');
                    $('.all-error').html(errorString);
                },
            });
            return false;
        }
    });


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/IPj031d
via IFTTT

Aucun commentaire:

Enregistrer un commentaire