Просмотр исходного кода

Add option to Add User screen, minor toolbar adjustments

Kristan Kenney 5 лет назад
Родитель
Сommit
f808cc9dcd

+ 10 - 0
web/add/user/index.php

@@ -85,6 +85,16 @@ if (!empty($_POST['ok'])) {
         unset($output);
     }
 
+    // Set login restriction
+    if (empty($_SESSION['error_msg'])) {
+        if ($_POST['v_login_disabled']) {
+            if ($_POST['v_login_disabled'] == 'on') { $_POST['v_login_disabled'] = 'yes'; } else { $_POST['v_login_disabled'] = 'no'; }
+            exec (HESTIA_CMD."v-change-user-config-value ".$v_username." LOGIN_DISABLED ".escapeshellarg($_POST['v_login_disabled']), $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);
+        }
+    }
+
     // Send email to the new user
     if ((empty($_SESSION['error_msg'])) && (!empty($v_notify))) {
         $to = $_POST['v_notify'];

+ 6 - 1
web/templates/pages/add_user.html

@@ -102,7 +102,12 @@
                                     </ul>
                                 </td>
                             </tr>
-                             <tr>
+                                <tr>
+                                    <td>
+                                        <label><input type="checkbox" size="20" class="vst-checkbox" onclick="javascript:elementHideShow('send-welcome');" name="v_login_disabled" <?php if ($data[$user]['LOGIN_DISABLED'] == "yes") echo "checked=yes" ?>><?php print _('Do not allow user to log in to Control Panel');?></label>
+                                    </td>
+                                </tr>
+                             <tr id="send-welcome">
                                 <td class="vst-text input-label">
                                     <label><input type="checkbox" size="20" class="vst-checkbox" name="v_email_notice" id='v_email_notify' value="" tabindex="5" /><?php print _('Send welcome email');?></label>
                                 </td>

+ 11 - 11
web/templates/pages/edit_user.html

@@ -129,18 +129,11 @@
                                     <meter max="4" id="meter"></meter>
                                 </td>
                             </tr>
-                            <? if ($_SESSION['userContext'] === 'admin') {?>
-                                <tr>
-                                    <td>
-                                        <label><input type="checkbox" size="20" class="vst-checkbox" onclick="javascript:elementHideShow('password-details')" name="v_login_disabled" <?php if ($data[$user]['LOGIN_DISABLED'] == "yes") echo "checked=yes" ?>><?php print _('Do not allow user to log in to Control Panel');?></label>
-                                    </td>
-                                </tr>
-                            <? } ?>
                             <tr>
                                 <td>
-                                    <table id="password-details" style="<?php if ($data[$user]['LOGIN_DISABLED'] == "yes") { echo 'display: none;'; } else { echo 'display: table-cell;'; }?>">
+                                    <table id="password-details">
                                         <tr>
-                                            <td class="vst-text step-top">
+                                            <td class="vst-text">
                                                 <?php print _('Your password must have at least');?>:
                                                 <ul>
                                                     <li><?php print _('8 characters long');?></li>
@@ -149,8 +142,15 @@
                                                 </ul>
                                             </td>
                                         </tr>
+                                        <? if ($_SESSION['userContext'] === 'admin') {?>
+                                            <tr>
+                                                <td>
+                                                    <label><input type="checkbox" size="20" class="vst-checkbox" onclick="javascript:elementHideShow('password-options');elementHideShow('password-options-ip');" name="v_login_disabled" <?php if ($data[$user]['LOGIN_DISABLED'] == "yes") echo "checked=yes" ?>><?php print _('Do not allow user to log in to Control Panel');?></label>
+                                                </td>
+                                            </tr>
+                                        <? } ?>
                                         <tr>
-                                            <td>
+                                            <td id="password-options" style="<?php if ($data[$user]['LOGIN_DISABLED'] == "yes") { echo 'display: none;'; } else { echo 'display: table-cell;'; }?>">
                                                 <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>
@@ -160,7 +160,7 @@
                                             </td>
                                         </tr>
                                         <tr>
-                                            <td>
+                                            <td id="password-options-ip" style="<?php if ($data[$user]['LOGIN_DISABLED'] == "yes") { echo 'display: none;'; } else { echo 'display: table-cell;'; }?>">
                                                 <label><input type="checkbox" size="20" class="vst-checkbox" onclick="javascript:elementHideShow('ip-allowlist')" name="v_login_use_iplist" <?php if ($data[$user]['LOGIN_USE_IPLIST'] === "yes") echo "checked=yes" ?>><?php print _('Use IP address allow list for login attempts');?></label>
                                             </td>
                                         </tr>

+ 1 - 1
web/templates/pages/list_cron.html

@@ -23,7 +23,7 @@
                 <?=_('sort by');?>: <span>
                   <b>
                     <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Command'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>

+ 1 - 1
web/templates/pages/list_db.html

@@ -41,7 +41,7 @@
                 <?=_('sort by');?>: <span>
                   <b>
                     <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Name'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>

+ 1 - 1
web/templates/pages/list_dns.html

@@ -21,7 +21,7 @@
                 <?=_('sort by');?>: <span>
                   <b>
                     <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Name'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>

+ 1 - 1
web/templates/pages/list_dns_rec.html

@@ -23,7 +23,7 @@
                 <?=_('sort by');?>: <span>
                   <b>
                     <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Record'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>

+ 1 - 1
web/templates/pages/list_mail.html

@@ -20,7 +20,7 @@
                 <?=_('sort by');?>: <span>
                   <b>
                     <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Name'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>

+ 1 - 1
web/templates/pages/list_mail_acc.html

@@ -26,7 +26,7 @@
                 <?=_('sort by');?>: <span>
                   <b>
                     <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Name'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>

+ 2 - 2
web/templates/pages/list_user.html

@@ -22,8 +22,8 @@
               <td class="sort-by" title="<?=_('Sort items');?>">
                 <?=_('sort by');?>: <span>
                   <b>
-                    <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Domain'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Name'; } else { $label = 'Date'; } ?>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>

+ 1 - 1
web/templates/pages/list_web.html

@@ -21,7 +21,7 @@
                 <?=_('sort by');?>: <span>
                   <b>
                     <? if ($_SESSION['userSortOrder'] === 'name') { $label = 'Name'; } else { $label = 'Date'; } ?>
-                    <?=_($label)?><i class="fas fa-sort-alpha-down"></i>
+                    <?=_($label)?> <i class="fas fa-sort-alpha-down"></i>
                   </b>
                 </span>
               </td>