This commit is contained in:
Alexey Berezhok
2024-03-19 22:05:27 +03:00
commit 346a50856b
1572 changed files with 182163 additions and 0 deletions

44
bin/v-log-user-logout Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
# info: Log User logout event
# options: USER FINGERPRINT
#----------------------------------------------------------#
# Variables & Functions #
#----------------------------------------------------------#
# Argument definition
user=$1
session_id=$2
# Includes
# shellcheck source=/etc/hestiacp/hestia.conf
source /etc/hestiacp/hestia.conf
# shellcheck source=/usr/local/hestia/func/main.sh
source $HESTIA/func/main.sh
# load config file
source_conf "$HESTIA/conf/hestia.conf"
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '2' "$#" 'USER SESSION_ID'
is_format_valid 'user'
is_common_format_valid "$session_id" "Session ID"
is_object_valid 'user' 'USER' "$user"
if [ ! -f "$USER_DATA/auth.log" ]; then
touch "$USER_DATA/auth.log"
fi
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
sed -i "s/SESSION='$session_id' ACTIVE='yes'/SESSION='$session_id' ACTIVE='no'/g" "$USER_DATA/auth.log"
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
exit