From f0ca3fef54d58fb369a99c769df571d76deed970 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sat, 7 Aug 2021 17:55:56 -0400 Subject: [PATCH] fix: correct count check for user-auth trigger There are cases where the user-auth plugin exists but the events plugin is not enabled, and this accounts for that. --- plugins/common/functions | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/common/functions b/plugins/common/functions index 9bd8d8c97..739da92c2 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -795,8 +795,15 @@ dokku_auth() { export SSH_USER=${SSH_USER:=$USER} export SSH_NAME=${NAME:="default"} + local user_auth_count=$(find "$PLUGIN_PATH"/enabled/*/user-auth 2>/dev/null | wc -l) + + # no plugin trigger exists + if [[ $user_auth_count == 0 ]]; then + return 0 + fi + # this plugin trigger exists in the core `20_events` plugin - if [[ $(find "$PLUGIN_PATH"/enabled/*/user-auth 2>/dev/null | wc -l) == 1 ]]; then + if [[ "$user_auth_count" == 1 ]] && [[ -f "$PLUGIN_PATH"/enabled/20_events/user-auth ]]; then return 0 fi