Przeglądaj źródła

Add option to "edit server" to pick login method

Default = "1.2.2 <"
Old = "Pre 2FA and then a second page with 2FA code (Or skip)"
Jaap Marcus 5 lat temu
rodzic
commit
fa8e6acc69

+ 1 - 0
bin/v-list-sys-config

@@ -57,6 +57,7 @@ json_list() {
         "WEBMAIL_ALIAS": "'$WEBMAIL_ALIAS'",
         "DB_PMA_ALIAS": "'$DB_PMA_ALIAS'",
         "DB_PGA_ALIAS": "'$DB_PGA_ALIAS'",
+        "LOGIN_STYLE": "'$LOGIN_STYLE'",
         "SOFTACULOUS": "'$SOFTACULOUS'"
     }
 }'

+ 3 - 0
install/hst-install-debian.sh

@@ -1080,6 +1080,9 @@ echo "BACKUP_MODE='zstd'" >> $HESTIA/conf/hestia.conf
 # Language
 echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
 
+# Login in screen
+echo "LOGIN_STYLE='default" >> $HESTIA/conf/hestia.conf
+
 # Version & Release Branch
 echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
 echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

+ 3 - 0
install/hst-install-ubuntu.sh

@@ -1118,6 +1118,9 @@ echo "BACKUP_MODE='zstd'" >> $HESTIA/conf/hestia.conf
 # Language
 echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
 
+# Login in screen
+echo "LOGIN_STYLE='default" >> $HESTIA/conf/hestia.conf
+
 # Version & Release Branch
 echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
 echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

+ 5 - 1
install/upgrade/versions/1.3.0.sh

@@ -56,4 +56,8 @@ fi
 
 # Change backup mode to zstd.
  echo "[ * ] Enable new backup compression zstd as default."
- $BIN/v-change-sys-config-value "BACKUP_MODE" "zstd"
+ $BIN/v-change-sys-config-value "BACKUP_MODE" "zstd"
+ 
+# Set var LOGIN_STYLE hestia.conf
+ echo "[ * ] Set var LOGIN_STYLE hestia.conf"
+ $BIN/v-change-sys-config-value "LOGIN_STYLE" "default" 

+ 11 - 0
web/edit/server/index.php

@@ -526,6 +526,17 @@ if (!empty($_POST['save'])) {
         }
     }
 
+    // Change backup gzip level
+    if (empty($_SESSION['error_msg'])) {
+        if ($_POST['v_login_style'] != $_SESSION['LOGIN_STYLE']) {
+            exec (HESTIA_CMD."v-change-sys-config-value LOGIN_STYLE ".escapeshellarg($_POST['v_login_style']), $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);
+            if (empty($_SESSION['error_msg'])) $v_backup_gzip = $_POST['v_login_style'];
+            $v_security_adv = 'yes';
+        }
+    }
+
     // Update SSL certificate
     if ((!empty($_POST['v_ssl_crt'])) && (empty($_SESSION['error_msg']))) {
         if (($v_ssl_crt != str_replace("\r\n", "\n",  $_POST['v_ssl_crt'])) || ($v_ssl_key != str_replace("\r\n", "\n",  $_POST['v_ssl_key']))) {

+ 10 - 2
web/login/index.php

@@ -192,10 +192,18 @@ require_once('../templates/header.html');
 if(!empty($_SESSION['login'])){
     require_once('../templates/login_2.html');    
 }else if (empty($_POST['user'])) {
-    require_once('../templates/login.html');
+    if($_SESSION['LOGIN_STYLE'] == 'old'){
+        require_once('../templates/login_a.html'); 
+    }else{
+        require_once('../templates/login.html');        
+    }
 }else if (empty($_POST['password'])) {
     require_once('../templates/login_1.html');
 }else{
-    require_once('../templates/login.html');
+    if($_SESSION['LOGIN_STYLE'] == 'old'){
+        require_once('../templates/login_a.html'); 
+    }else{
+        require_once('../templates/login.html');        
+    }
 }
 ?>

+ 27 - 1
web/templates/admin/edit_server.html

@@ -842,7 +842,33 @@
                                     </table>
                                 </td>
                             </tr>
-
+<tr>
+                                <td class="vst-text input-label step-top advanced-options">
+                                    <a href="javascript:elementHideShow('security');" class="vst-text">
+                                        <i class="fas fa-key"></i><b><?php print _('Security');?> <img src="/images/arrow.png"></b>
+                                    </a>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class="vst-text input-label step-left">
+                                    <table style="display:<?php if (empty($v_security_adv)) echo 'none';?> ;" id="security">
+                                        <tr>
+                                            <td class="vst-text input-label">
+                                                <?php print _('Login screen style');?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <select class="vst-list" name="v_login_style">
+                                                    <option value='default'><?php print _('Default'); ?></option>
+                                                    <option value='old' <?php if($_SESSION['LOGIN_STYLE'] == 'old') echo 'selected' ?> ><?php print _('Old Style'); ?></option>
+                                                </select>
+                                                <br><br>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </td>
+                            </tr>
 
                             <tr>
                                 <td class="vst-text input-label step-top advanced-options">

+ 65 - 0
web/templates/login_a.html

@@ -0,0 +1,65 @@
+        <center>
+            <table class="login animated zoomIn">
+                <tr>
+                    <td>
+                        <table>
+                            <tr>
+                                <td style="padding: 22px 30px 0 42px; height: 280px; width: 170px;">
+                                    <a href="/"><img border=0 src="/images/logo.svg" alt="<?=_('Hestia Control Panel');?>" style="margin-top: 70px;" /></a>
+                                </td>
+                                <td style="padding: 40px 60px 0 0;">
+                                    <form method="post" action="/login/" id="form_login">
+                                    <input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
+                                    <table class="login-box">
+                                        <tr>
+                                            <td style="padding: 12px 0 0 2px;" class="login-welcome">
+                                                <?php print _('Welcome to Hestia Control Panel');?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td style="padding: 12px 0 5px 2px;">
+                                                <?php print _('Username');?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <input tabindex="1" type="text" size="20px" style="width:240px;" name="user" class="vst-input" autofocus />
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td style="padding: 12px 0 5px 2px;">
+                                                <?php print _('Password');?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <input tabindex="2" type="password" size="20px"  style="width:240px;" name="password" class="vst-input" />
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td height="10px">
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td style="padding: 0 0 5px 0;">
+                                                <button tabindex="3" type="submit" class="button"><?php print _('Next');?>&nbsp;&nbsp;&nbsp;<i class="fas fa-sign-in-alt"></i></button>
+                                            </td>
+                                        </tr>
+                                    </table>
+                                </form>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td colspan=2>
+                                <div class="login-bottom">
+                                    <div style="height:20px"><?php if (isset($error)) echo $error ?></div>
+                                </div>
+                            </td>
+                        </tr>
+                    </table>
+                </tr>
+            </table>
+        </center>
+
+    </body>
+</html>