<form class="form-horizontal user-setting-panel pt_forms pt_shadow" id="two-factor" method="POST">
	<div class="yp_sett_header">
		<h4>{{LANG two_factor}} {{LANG settings}}</h4>
	</div>
    <div class="alert alert-info">
         {{LANG two_factor_description}}
        </div>
	<div class="two-factor-alert"></div>
	<div class="row">
        <!-- Text input-->
        <div class="form-group col-lg-7">
            <label class="col-md-12" for="two_factor">{{LANG two_factor}}</label>
            <div class="col-md-12">
                <select id="two_factor" name="two_factor" class="form-control">
                    <option value="0" <?php echo ($pt->settings->two_factor == '0') ? 'selected': '';?>>{{LANG disable}}</option>
                    <option value="1" <?php echo ($pt->settings->two_factor == '1') ? 'selected': '';?>>{{LANG enable}}</option>
                </select>
            </div>
        </div>
        <div class="clear"></div>
        <hr>
        
	</div>
	<input type="hidden" name="hash_id" value="<?php echo PT_CreateSession()?>">
	<input type="hidden" name="user_id" value="{{USER id}}">
	<!-- Button (Double) -->
	<div>
		<button id="submit" name="submit" class="btn btn-main setting-panel-mdbtn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg> {{LANG save}}</button>
	</div>
</form>

<script>
    $(function() {
        var form = $('form#two-factor');

        form.ajaxForm({
            url: '{{LINK aj/user/two_factor}}?hash=' + $('.main_session').val(),
            beforeSend: function() {
                form.find('button').text("{{LANG please_wait}}");
            },
            success: function(data) {
                scrollToTop();
                if (data.status == 200) {
                    $('.two-factor-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>");
                    $('.two-factor-alert').html('<div class="alert alert-danger">' + errors + '</div>');
                    $('.alert-danger').fadeIn(300);
                }
                form.find('button').html('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg> {{LANG save}}');
                // FL_progressIconLoader(form.find('button'));
            }
        });
    });
</script>