Skip to content

Commit fa8e6ac

Browse files
committed
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)"
1 parent 853fcb2 commit fa8e6ac

File tree

8 files changed

+125
-4
lines changed

8 files changed

+125
-4
lines changed

bin/v-list-sys-config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ json_list() {
5757
"WEBMAIL_ALIAS": "'$WEBMAIL_ALIAS'",
5858
"DB_PMA_ALIAS": "'$DB_PMA_ALIAS'",
5959
"DB_PGA_ALIAS": "'$DB_PGA_ALIAS'",
60+
"LOGIN_STYLE": "'$LOGIN_STYLE'",
6061
"SOFTACULOUS": "'$SOFTACULOUS'"
6162
}
6263
}'

install/hst-install-debian.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,9 @@ echo "BACKUP_MODE='zstd'" >> $HESTIA/conf/hestia.conf
10801080
# Language
10811081
echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
10821082

1083+
# Login in screen
1084+
echo "LOGIN_STYLE='default" >> $HESTIA/conf/hestia.conf
1085+
10831086
# Version & Release Branch
10841087
echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
10851088
echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

install/hst-install-ubuntu.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,9 @@ echo "BACKUP_MODE='zstd'" >> $HESTIA/conf/hestia.conf
11181118
# Language
11191119
echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
11201120

1121+
# Login in screen
1122+
echo "LOGIN_STYLE='default" >> $HESTIA/conf/hestia.conf
1123+
11211124
# Version & Release Branch
11221125
echo "VERSION='${HESTIA_INSTALL_VER}'" >> $HESTIA/conf/hestia.conf
11231126
echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf

install/upgrade/versions/1.3.0.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ fi
5656

5757
# Change backup mode to zstd.
5858
echo "[ * ] Enable new backup compression zstd as default."
59-
$BIN/v-change-sys-config-value "BACKUP_MODE" "zstd"
59+
$BIN/v-change-sys-config-value "BACKUP_MODE" "zstd"
60+
61+
# Set var LOGIN_STYLE hestia.conf
62+
echo "[ * ] Set var LOGIN_STYLE hestia.conf"
63+
$BIN/v-change-sys-config-value "LOGIN_STYLE" "default"

web/edit/server/index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,17 @@
526526
}
527527
}
528528

529+
// Change backup gzip level
530+
if (empty($_SESSION['error_msg'])) {
531+
if ($_POST['v_login_style'] != $_SESSION['LOGIN_STYLE']) {
532+
exec (HESTIA_CMD."v-change-sys-config-value LOGIN_STYLE ".escapeshellarg($_POST['v_login_style']), $output, $return_var);
533+
check_return_code($return_var,$output);
534+
unset($output);
535+
if (empty($_SESSION['error_msg'])) $v_backup_gzip = $_POST['v_login_style'];
536+
$v_security_adv = 'yes';
537+
}
538+
}
539+
529540
// Update SSL certificate
530541
if ((!empty($_POST['v_ssl_crt'])) && (empty($_SESSION['error_msg']))) {
531542
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']))) {

web/login/index.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,18 @@ function authenticate_user($user, $password, $twofa = ''){
192192
if(!empty($_SESSION['login'])){
193193
require_once('../templates/login_2.html');
194194
}else if (empty($_POST['user'])) {
195-
require_once('../templates/login.html');
195+
if($_SESSION['LOGIN_STYLE'] == 'old'){
196+
require_once('../templates/login_a.html');
197+
}else{
198+
require_once('../templates/login.html');
199+
}
196200
}else if (empty($_POST['password'])) {
197201
require_once('../templates/login_1.html');
198202
}else{
199-
require_once('../templates/login.html');
203+
if($_SESSION['LOGIN_STYLE'] == 'old'){
204+
require_once('../templates/login_a.html');
205+
}else{
206+
require_once('../templates/login.html');
207+
}
200208
}
201209
?>

web/templates/admin/edit_server.html

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,33 @@
842842
</table>
843843
</td>
844844
</tr>
845-
845+
<tr>
846+
<td class="vst-text input-label step-top advanced-options">
847+
<a href="javascript:elementHideShow('security');" class="vst-text">
848+
<i class="fas fa-key"></i><b><?php print _('Security');?> <img src="/images/arrow.png"></b>
849+
</a>
850+
</td>
851+
</tr>
852+
<tr>
853+
<td class="vst-text input-label step-left">
854+
<table style="display:<?php if (empty($v_security_adv)) echo 'none';?> ;" id="security">
855+
<tr>
856+
<td class="vst-text input-label">
857+
<?php print _('Login screen style');?>
858+
</td>
859+
</tr>
860+
<tr>
861+
<td>
862+
<select class="vst-list" name="v_login_style">
863+
<option value='default'><?php print _('Default'); ?></option>
864+
<option value='old' <?php if($_SESSION['LOGIN_STYLE'] == 'old') echo 'selected' ?> ><?php print _('Old Style'); ?></option>
865+
</select>
866+
<br><br>
867+
</td>
868+
</tr>
869+
</table>
870+
</td>
871+
</tr>
846872

847873
<tr>
848874
<td class="vst-text input-label step-top advanced-options">

web/templates/login_a.html

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<center>
2+
<table class="login animated zoomIn">
3+
<tr>
4+
<td>
5+
<table>
6+
<tr>
7+
<td style="padding: 22px 30px 0 42px; height: 280px; width: 170px;">
8+
<a href="/"><img border=0 src="/images/logo.svg" alt="<?=_('Hestia Control Panel');?>" style="margin-top: 70px;" /></a>
9+
</td>
10+
<td style="padding: 40px 60px 0 0;">
11+
<form method="post" action="/login/" id="form_login">
12+
<input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>">
13+
<table class="login-box">
14+
<tr>
15+
<td style="padding: 12px 0 0 2px;" class="login-welcome">
16+
<?php print _('Welcome to Hestia Control Panel');?>
17+
</td>
18+
</tr>
19+
<tr>
20+
<td style="padding: 12px 0 5px 2px;">
21+
<?php print _('Username');?>
22+
</td>
23+
</tr>
24+
<tr>
25+
<td>
26+
<input tabindex="1" type="text" size="20px" style="width:240px;" name="user" class="vst-input" autofocus />
27+
</td>
28+
</tr>
29+
<tr>
30+
<td style="padding: 12px 0 5px 2px;">
31+
<?php print _('Password');?>
32+
</td>
33+
</tr>
34+
<tr>
35+
<td>
36+
<input tabindex="2" type="password" size="20px" style="width:240px;" name="password" class="vst-input" />
37+
</td>
38+
</tr>
39+
<tr>
40+
<td height="10px">
41+
</td>
42+
</tr>
43+
<tr>
44+
<td style="padding: 0 0 5px 0;">
45+
<button tabindex="3" type="submit" class="button"><?php print _('Next');?>&nbsp;&nbsp;&nbsp;<i class="fas fa-sign-in-alt"></i></button>
46+
</td>
47+
</tr>
48+
</table>
49+
</form>
50+
</td>
51+
</tr>
52+
<tr>
53+
<td colspan=2>
54+
<div class="login-bottom">
55+
<div style="height:20px"><?php if (isset($error)) echo $error ?></div>
56+
</div>
57+
</td>
58+
</tr>
59+
</table>
60+
</tr>
61+
</table>
62+
</center>
63+
64+
</body>
65+
</html>

0 commit comments

Comments
 (0)