Prevent admin deleting their own peer
parent
0e1c97a366
commit
d3d5087830
|
@ -73,6 +73,14 @@ if ! printf 'Delete request was for %s %s %s\n' "${domain:?}" "${ipv4:?}" "${ipv
|
|||
printf 'Failed to collect peer data\n' | "${LIB_DIR}/http_res" 500
|
||||
exit 6
|
||||
fi
|
||||
|
||||
# Make sure admin isn't deleting their own peer
|
||||
if [ "${ip}" == "${ipv4}" ] || [ "${ip}" == "${ipv4}" ]; then
|
||||
printf 'Admin requested to delete peer from itself: %s.\n' "" >>"${LOGFILE}"
|
||||
printf 'You cannot delete a peer from that peer! Make the request from a different device.' | "${LIB_DIR}/http_res" 400
|
||||
exit 7
|
||||
fi
|
||||
|
||||
hostname="$(<<<"${domain}" cut -d'.' -f1)"
|
||||
username="$(<<<"${domain}" cut -d'.' -f2)"
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ fi
|
|||
# Make sure user isn't deleting their own peer
|
||||
if [ "${ip}" == "${ipv4}" ] || [ "${ip}" == "${ipv4}" ]; then
|
||||
printf 'User requested to delete peer from itself: %s.\n' "" >>"${LOGFILE}"
|
||||
printf 'You cannot delete a peer from that peer. Make the request from a different device.' | "${LIB_DIR}/http_res" 400
|
||||
printf 'You cannot delete a peer from that peer! Make the request from a different device.' | "${LIB_DIR}/http_res" 400
|
||||
exit 7
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue