Skip to content

Commit 0661bfd

Browse files
authored
Notifiy user when suspended (hestiacp#2345)
* Notifiy user when suspended Add error message when user tries to login * Force users to use hostname instead any domain Possible method for gaining access via clientdomain.com and changing DNS
1 parent ba044ff commit 0661bfd

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

bin/v-get-user-salt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ then
9393
echo "$date $time $user $ip failed to login" >> $HESTIA/log/auth.log
9494
exit 9
9595
fi
96+
elif [[ "$shadow" =~ ! ]]; then
97+
echo "Error: Account has been suspended"
98+
echo "$date $time $user $ip has been suspended" >> $HESTIA/log/auth.log
99+
exit 5
96100
else
97101
salt=${shadow:0:2}
98102
method='des'

web/login/index.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ function authenticate_user($user, $password, $twofa = '')
105105
$pam = json_decode(implode('', $output), true);
106106
if ($return_var > 0) {
107107
sleep(2);
108-
$error = '<a class="error">' . _('Invalid username or password') . '</a>';
108+
if($return_var == 5){
109+
$error = '<a class="error">' . _('Account has been suspended') . '</a>';
110+
}else{
111+
$error = '<a class="error">' . _('Invalid username or password') . '</a>';
112+
}
109113
return $error;
110114
} else {
111115
$salt = $pam[$user]['SALT'];

web/reset/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
} else {
5353
$mailtext = _('GREETINGS');
5454
}
55-
if (in_array(str_replace(':'.$_SERVER['SERVER_PORT'], '.conf', $_SERVER['HTTP_HOST']), array_merge(scandir('/etc/nginx/conf.d'), scandir('/etc/nginx/conf.d/domains'), scandir('/etc/apache2/conf.d/domains'), scandir('/etc/apache2/conf.d')))) {
55+
if ($hostname.":".$_SERVER['SERVER_PORT'] == $_SERVER['HTTP_HOST']) {
5656
$mailtext .= sprintf(_('PASSWORD_RESET_REQUEST'), $_SERVER['HTTP_HOST'], $user, $rkey, $_SERVER['HTTP_HOST'], $user, $rkey);
5757
if (!empty($rkey)) {
5858
send_email($to, $subject, $mailtext, $from, $from_name, $data[$user]['NAME']);

0 commit comments

Comments
 (0)