File tree Expand file tree Collapse file tree 2 files changed +22
-19
lines changed
Expand file tree Collapse file tree 2 files changed +22
-19
lines changed Original file line number Diff line number Diff line change 33#
44# The function for deleting a users auth log file
55
6+ # ----------------------------------------------------------#
7+ # Variable&Function #
8+ # ----------------------------------------------------------#
9+
610# Argument definition
711user=$1
8- date=$( date " +%F %T" )
912
1013# Includes
1114source $HESTIA /func/main.sh
@@ -22,17 +25,15 @@ check_args '1' "$#" 'USER'
2225is_format_valid ' user'
2326is_object_valid ' user' ' USER' " $user "
2427
25- if [ ! -f $USER_DATA /auth.log ]; then
26- touch $USER_DATA /auth.log
27- fi
28-
2928# ----------------------------------------------------------#
3029# Action #
3130# ----------------------------------------------------------#
3231
33- rm $USER_DATA /auth.log
34-
35- log_history " Authentication log for $user was cleared on $date ."
36- log_event " $OK " " $ARGUMENTS "
32+ # Remove log file and log event
33+ if [ -f $USER_DATA /auth.log ]; then
34+ rm -f $USER_DATA /auth.log
35+ log_history " login history for $user was cleared."
36+ log_event " $OK " " $ARGUMENTS "
37+ fi
3738
3839exit
Original file line number Diff line number Diff line change 1313
1414# Argument definition
1515user=$1
16- date=$( date " +%F %T" )
1716
1817# Includes
1918source $HESTIA /func/main.sh
@@ -22,20 +21,23 @@ source $HESTIA/conf/hestia.conf
2221# Perform verification if read-only mode is enabled
2322check_hestia_demo_mode
2423
24+ # ----------------------------------------------------------#
25+ # Verifications #
26+ # ----------------------------------------------------------#
27+
28+ check_args ' 1' " $# " ' USER'
29+ is_format_valid ' user'
30+ is_object_valid ' user' ' USER' " $user "
31+
2532# ----------------------------------------------------------#
2633# Action #
2734# ----------------------------------------------------------#
2835
29- # Remove log file
30- if [ -z $user ]; then
31- echo " Error: no user specified."
32- elif [ ! -f " $HESTIA /data/users/$user /history.log" ]; then
33- echo " Error: no history log found for $user ."
34- else
36+ # Remove log file and log event
37+ if [ -f " $HESTIA /data/users/$user /history.log" ]; then
3538 rm -f $HESTIA /data/users/$user /history.log
39+ log_history " user action log for $user was cleared."
40+ log_event " $OK " " $ARGUMENTS "
3641fi
3742
38- log_history " Log for $user was cleared on $date ."
39- log_event " $OK " " $ARGUMENTS "
40-
4143exit
You can’t perform that action at this time.
0 commit comments