Skip to content

Commit 7d22f1f

Browse files
committed
Disable login into admin via root / password
See https://forum.hestiacp.com/t/how-to-disable-root-web-login/1610/2
1 parent 90f5e24 commit 7d22f1f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

web/login/index.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ function authenticate_user(){
4141
if(!empty($_SERVER['HTTP_CF_CONNECTING_IP'])){
4242
$v_ip = escapeshellarg($_SERVER['HTTP_CF_CONNECTING_IP']);
4343
}
44-
}
44+
}
45+
if($_POST['user'] == 'root'){
46+
unset($_POST['password']);
47+
unset($_POST['user']);
48+
$error = "<a class=\"error\">".__('Login with <strong>root</strong> has been disabled')."</a>";
49+
return $error;
50+
}
51+
52+
4553
// Get user's salt
4654
$output = '';
4755
exec (HESTIA_CMD."v-get-user-salt ".$v_user." ".$v_ip." json" , $output, $return_var);
@@ -89,10 +97,6 @@ function authenticate_user(){
8997
$error = "<a class=\"error\">".__('Invalid username or password')."</a>";
9098
return $error;
9199
} else {
92-
93-
// Make root admin user
94-
if ($_POST['user'] == 'root') $v_user = 'admin';
95-
96100
// Get user speciefic parameters
97101
exec (HESTIA_CMD . "v-list-user ".$v_user." json", $output, $return_var);
98102
$data = json_decode(implode('', $output), true);

0 commit comments

Comments
 (0)