/**
 * This <server-gardu-reporter> project created by :
 * Name         : syafiq
 * Date / Time  : 28 June 2017, 11:03 PM.
 * Email        : syafiq.rezpector@gmail.com
 * Github       : syafiqq
 */

(function ($)
{
    $(function ()
    {
        NProgress.configure({
            showSpinner: false,
            template: '<div class="bar" role="bar" style="background-color: red"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
        });

        $('form#login').on('submit', function (event)
        {
            event.preventDefault();
            var form = $(this);

            var input = form.serializeObject();

            input['remember_me'] = $(this).find('input[type=checkbox][name=remember_me]').prop('checked');
            if ((input['remember_me'] === undefined) || (input['remember_me'] === null))
            {
                input['remember_me'] = 0;
            }
            else
            {
                input['remember_me'] = input['remember_me'] ? 1 : 0;
            }

            NProgress.start();
            $.post(
                form.attr('action'),
                input,
                null,
                'json')
                .done(function (response)
                {
                    let status = ['danger', 'info', 'warning', 'success'];
                    let type = ['login', 'validation'];
                    if (response['data'] !== undefined)
                    {
                        if (response['data']['message'] !== undefined)
                        {
                            for (let i = -1, is = type.length; ++i < is;)
                            {
                                if (response['data']['message'][type[i]] !== undefined)
                                {
                                    for (let j = -1, js = status.length; ++j < js;)
                                    {
                                        if (response['data']['message'][type[i]][status[j]] !== undefined)
                                        {
                                            let template = '<div class="alert alert-' + status[j] + ' alert-dismissible">'
                                                + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'
                                                + '<ul>';
                                            for (let k = -1, ks = response['data']['message'][type[i]][status[j]].length; ++k < ks;)
                                            {
                                                template += '<li>' + response['data']['message'][type[i]][status[j]][k] + '</li>'
                                            }
                                            template += '</ul>'
                                                + '</div>';
                                            $("div#form-message-container").empty().append(template);
                                        }
                                    }
                                }
                            }
                        }

                        if (response['data']['redirect'] !== undefined)
                        {
                            location.href = response['data']['redirect'];
                        }
                    }
                })
                .fail(function ()
                {
                })
                .always(function ()
                {
                    NProgress.done();
                });
        });

        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });

        if ((sessionFlashdata !== undefined) && (sessionFlashdata !== null))
        {
            for (let i = -1, is = sessionFlashdata.length; ++i < is;)
            {
                $.notify({
                    message: sessionFlashdata[i]
                }, {
                    type: 'info'
                });
            }
        }
    });
    /*
     * Run right away
     * */
})(jQuery);

@@ -606,19 +606,19 @@
         
-var
+let
  form = 
@@ -643,11 +643,11 @@
     
-var
+let
  inp
@@ -713,20 +713,20 @@
 e'%5D = $(
-this
+form
 ).find('
@@ -734,22 +734,17 @@
 nput
-%5Btype=
+:
 checkbox
 %5D%5Bna
@@ -739,17 +739,16 @@
 checkbox
-%5D
 %5Bname=re
@@ -3338,32 +3338,296 @@
                %7D
+%0A%0A                        if (response%5B'data'%5D%5B'csrf'%5D !== undefined)%0A                        %7B%0A                            $(form).find('input:hidden%5Bname=' + response%5B'data'%5D%5B'csrf'%5D%5B'name'%5D + '%5D').val(response%5B'data'%5D%5B'csrf'%5D%5B'hash'%5D);%0A                        %7D
 %0A               

Add form security refresh