diff --git a/pro/auth/azure-ad.go b/pro/auth/azure-ad.go index d0454cf3..b6f1e9ff 100644 --- a/pro/auth/azure-ad.go +++ b/pro/auth/azure-ad.go @@ -86,7 +86,7 @@ func handleAzureCallback(w http.ResponseWriter, r *http.Request) { inviteExists = true } // check if user approval is already pending - if !inviteExists && logic.IsPendingUser(content.Email) { + if !inviteExists && (logic.IsPendingUser(content.Email) || logic.IsPendingUser(content.UserPrincipalName)) { handleOauthUserSignUpApprovalPending(w) return } @@ -109,6 +109,7 @@ func handleAzureCallback(w http.ResponseWriter, r *http.Request) { return } logic.DeleteUserInvite(content.Email) + logic.DeletePendingUser(content.UserPrincipalName) logic.DeletePendingUser(content.Email) } else { if !isEmailAllowed(content.Email) {