Skip to content

Commit 61bca69

Browse files
authored
1 parent 03c1d88 commit 61bca69

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

bin/v-check-user-password

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ if [ "$method" = "yescrypt" ]; then
9595

9696
if [ $? -ne 0 ]; then
9797
echo "Error: password missmatch"
98-
echo "$date $time $user $ip46 failed to login" >> $HESTIA/log/auth.log
98+
if [ -z "$return_hash" ]; then
99+
echo "$date $time $user $ip46 failed to login" >> $HESTIA/log/auth.log
100+
fi
99101
exit 9
100102
fi
101103
else
@@ -104,7 +106,9 @@ else
104106
hash=$($BIN/v-generate-password-hash "$method" "$salt" <<< "$password")
105107
if [[ -z "$hash" ]]; then
106108
echo "Error: password missmatch"
107-
echo "$date $time $user $ip46 failed to login" >> $HESTIA/log/auth.log
109+
if [ -z "$return_hash" ]; then
110+
echo "$date $time $user $ip46 failed to login" >> $HESTIA/log/auth.log
111+
fi
108112
exit 9
109113
fi
110114
fi
@@ -113,7 +117,9 @@ fi
113117
result=$(grep "^$user:$hash:" /etc/shadow 2> /dev/null)
114118
if [[ -z "$result" ]]; then
115119
echo "Error: password missmatch"
116-
echo "$date $time $user $ip46 failed to login" >> $HESTIA/log/auth.log
120+
if [ -z "$return_hash" ]; then
121+
echo "$date $time $user $ip46 failed to login" >> $HESTIA/log/auth.log
122+
fi
117123
exit 9
118124
fi
119125

@@ -123,8 +129,9 @@ fi
123129

124130
if [ -n "$return_hash" ]; then
125131
echo $hash
132+
else
133+
# If return_hash is pressent it will log a second time
134+
echo "$date $time $user $ip46 successfully logged in" >> $HESTIA/log/auth.log
126135
fi
127-
# Logging
128-
echo "$date $time $user $ip46 successfully logged in" >> $HESTIA/log/auth.log
129136

130137
exit

0 commit comments

Comments
 (0)