Initial
This commit is contained in:
44
bin/v-log-user-logout
Executable file
44
bin/v-log-user-logout
Executable 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
|
||||
Reference in New Issue
Block a user