<div class="l-center edit">
        <div class="l-sort clearfix">
          <div class="l-unit-toolbar__buttonstrip">
            <a class="ui-button cancel" id="btn-back" href="/list/user/"><i class="fas fa-arrow-left status-icon blue"></i> <?=_('Back')?></a>
            <a href="/list/key/" id="btn-create" class="ui-button cancel" title="<?=_('SSH_KEY');?>"><i class="fas fa-key status-icon green"></i><?=_('SSH KEY')?></a>
          </div>
          <div class="l-unit-toolbar__buttonstrip float-right">
            <a href="#" class="ui-button" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i> <?=_('Save')?></a>
          </div>
        </div>
      </div>

    <div class="l-separator"></div>

    <div class="l-center animated fadeIn">
        <?php
            $back = $_SESSION['back'];
            if (empty($back)) {
                $back = "location.href='/list/user/'";
            } else {
                $back = "location.href='".$back."'";
            }
        ?>
        <form id="vstobjects" method="post" name="v_edit_user" class="<?=$v_status?>">
            <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
            <input type="hidden" name="save" value="save" />

            <table class='data'>
                <tr class="data-add">
                    <td class="data-dotted">
                        <table class="data-col1">
                            <tr>
                                <td>
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td class="data-dotted">
                        <table class="data-col2">
                            <tr>
                                <td class="step-top">
                                    <span class="page-title"><?=_('Editing User')?></span>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <?php
                                        if (!empty($_SESSION['error_msg'])) {
                                            echo "<span class=\"vst-error\"> <i class=\"fas fa-exclamation-circle status-icon red\"></i> ".htmlentities($_SESSION['error_msg'])."</span>";
                                        } else {
                                            if (!empty($_SESSION['ok_msg'])) {
                                                echo "<span class=\"vst-ok\"> <i class=\"fas fa-check-circle status-icon green\"></i> ".$_SESSION['ok_msg']."</span>";
                                            }
                                        }
                                    ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text step-top">
                                    <?php print _('Username');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input" name="v_user" value="<?=htmlentities(trim($v_username, "'"))?>" disabled>
                                    <input type="hidden" name="v_username" value="<?=htmlentities(trim($v_username, "'"))?>">
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print _('Password');?> / <a href="javascript:randomString();" class="generate"><?php print _('generate');?></a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input password" name="v_password" value="<?=htmlentities(trim($v_password, "'"))?>"><br />
                                    <meter max="4" id="meter"></meter>       
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text">
                                    <?php print _('Your password must have at least');?>
                                    <ul>
                                        <li><?php print _('8 characters long');?></li>
                                        <li><?php print _('1 uppercase & 1 lowercase character');?></li>
                                        <li><?php print _('1 number');?></li>
                                    </ul>
                                </td>
                            </tr>                            
                            <tr>
                                <td>
                                    <label><input type="checkbox" class="vst-checkbox password-option" name="v_twofa" <?php if(!empty($v_twofa)) echo "checked=yes" ?>> <?php print _('Enable 2FA');?></label>
                                    <?php if (!empty($v_twofa)) { ?>
                                    <p><?php echo _('2FA Reset Code:').' '.$v_twofa; ?></br></p>
                                    <p><?php echo _('Please scan the code below in your 2FA application:'); ?></p>
                                    <div><img class="qr-code" src="<?php echo $v_qrcode; ?>"></div>
                                    <?php } ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print _('Contact');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input" name="v_name" value="<?=htmlentities(trim($v_name, "'"))?>">
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print _('Email');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input" name="v_email" value="<?=htmlentities(trim($v_email, "'"))?>">
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print _('Language');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <select class="vst-list" name="v_language">
                                        <?php
                                            foreach ($languages as $key => $value) {
                                                echo "\n\t\t\t\t\t\t\t\t\t<option value=\"".$value."\"";
                                                $svalue = "'".$value."'";
                                                if (( $value == $v_language ) || ( $svalue == $v_language)){
                                                    echo 'selected' ;
                                                }
                                                if (( $value == detect_user_language() ) && (empty($v_language))){
                                                    echo 'selected' ;
                                                }
                                                echo ">".htmlentities($value)."</option>\n";
                                            }
                                        ?>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print _('Default Name Servers');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input" name="v_ns1" value="<?=htmlentities(trim($v_ns1, "'"))?>">
                                    <span class="remove-ns additional-control delete"><?=_('delete')?></span>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input" name="v_ns2" value="<?=htmlentities(trim($v_ns2, "'"))?>">
                                    <span class="remove-ns additional-control delete"><?=_('delete')?></span>
                                </td>
                            </tr>
                            <?  if($v_ns3)
                                  echo '<tr>
                                    <td>
                                        <input type="text" size="20" class="vst-input" name="v_ns3" value="'.htmlentities(trim($v_ns3, "'")).'">
                                        <span class="remove-ns additional-control delete">'._('delete').'</span>
                                    </td>
                                </tr>';

                                if($v_ns4)
                                  echo '<tr>
                                    <td>
                                        <input type="text" size="20" class="vst-input" name="v_ns4" value="'.htmlentities(trim($v_ns4, "'")).'">
                                        <span class="remove-ns additional-control delete">'._('delete').'</span>
                                    </td>
                                </tr>';

                                if($v_ns5)
                                  echo '<tr>
                                    <td>
                                        <input type="text" size="20" class="vst-input" name="v_ns5" value="'.htmlentities(trim($v_ns5, "'")).'">
                                        <span class="remove-ns additional-control delete">'._('delete').'</span>
                                    </td>
                                </tr>';

                                if($v_ns6)
                                  echo '<tr>
                                    <td>
                                        <input type="text" size="20" class="vst-input" name="v_ns6" value="'.htmlentities(trim($v_ns6, "'")).'">
                                        <span class="remove-ns additional-control delete">'._('delete').'</span>
                                    </td>
                                </tr>';

                                if($v_ns7)
                                  echo '<tr>
                                    <td>
                                        <input type="text" size="20" class="vst-input" name="v_ns7" value="'.htmlentities(trim($v_ns7, "'")).'">
                                        <span class="remove-ns additional-control delete">'._('delete').'</span>
                                    </td>
                                </tr>';

                                if($v_ns8)
                                  echo '<tr>
                                    <td>
                                        <input type="text" size="20" class="vst-input" name="v_ns8" value="'.htmlentities(trim($v_ns8, "'")).'">
                                        <span class="remove-ns additional-control delete">'._('delete').'</span>
                                    </td>
                                </tr>';
                            ?>
                                <tr class="add-ns" <? if($v_ns8) echo 'style="display:none;"'; ?> >
                                    <td class="step-top-small">
                                      <span class="add-ns-button additional-control add"><?=_('Add one more Name Server')?></span>
                                    </td>
                                </tr>
                        </table>
                        <table class="data-col2"></table>
                    </td>
                </tr>
            </table>
        </form>
    </div>
