<div class="settings-header">
    <h3><i class="fa fa-key fa-fw "></i> {{LANG password_settings}}</h3>
</div>
<form class="form-horizontal user-setting-panel " id="password-settings" method="POST">
    <div class="setting-password-alert"></div>
    <fieldset>
        <!-- password input-->
        <div class="form-group">
            <label class="col-md-3" for="current_password">{{LANG current_password}}</label>
            <div class="col-md-6">
                <input id="current_password" name="current_password" type="password" placeholder="" class="form-control input-md">
            </div>
        </div>
        <!-- password input-->
        <div class="form-group">
            <label class="col-md-3" for="new_password">{{LANG new_password}}</label>
            <div class="col-md-6">
                <input id="new_password" name="new_password" type="password" placeholder="" class="form-control input-md">
            </div>
        </div>
        <!-- password input-->
        <div class="form-group">
            <label class="col-md-3" for="confirm_new_password">{{LANG confirm_new_password}}</label>
            <div class="col-md-6">
                <input id="confirm_new_password" name="confirm_new_password" type="password" placeholder="" class="form-control input-md">
            </div>
        </div>
        <hr>
        <input type="hidden" name="hash_id" value="<?php echo PT_CreateSession()?>">
        <input type="hidden" name="user_id" value="{{USER id}}">
        <!-- Button (Double) -->
        <div class="form-group">
            <label class="col-md-2" for="button1id"></label>
            <div class="col-md-8">
                <button id="submit" name="submit" class="btn btn-main"><i class="fa fa-floppy-o progress-icon" data-icon="floppy-o"></i> {{LANG save}}</button>
            </div>
        </div>
    </fieldset>
</form>

<script>
    $(function() {
        var form = $('form#password-settings');
        form.ajaxForm({
            url: '{{LINK aj/user/change-pass}}?hash=' + $('.main_session').val(),
            beforeSend: function() {
                form.find('button').text('{{LANG please_wait}}');
                // FL_progressIconLoader(form.find('button'));
            },
            success: function(data) {
                scrollToTop();
                if (data.status == 200) {
                    $('.setting-password-alert').html('<div class="alert alert-success">' + data.message + '</div>');
                    $('.alert-success').fadeIn('fast', function() {
                        $(this).delay(2500).slideUp(500, function() {
                            $(this).remove();
                        });
                    });
                } else if (data.errors) {
                    var errors = data.errors.join("<br>");
                    $('.setting-password-alert').html('<div class="alert alert-danger">' + errors + '</div>');
                    $('.alert-danger').fadeIn(300);
                }
                form.find('button').html('<i class="fa fa-floppy-o progress-icon" data-icon="floppy-o"></i> {{LANG save}}');
                // FL_progressIconLoader(form.find('button'));
            }
        });
    });
</script>