Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Fix AllowedADGroups and captcha validation #651

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private string FixUsernameWithDomain(string username)
"The User principal is listed as restricted");
}

return groups?.Any(x => _options.AllowedADGroups?.Contains(x.Name) == true) == true
return groups?.Any(x => _options.AllowedADGroups?.Contains(x.Name) != false) == true
? null
: new ApiErrorItem(ApiErrorCode.ChangeNotPermitted, "The User principal is not listed as allowed");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ private async Task<bool> ValidateRecaptcha(string? recaptchaResponse)
// skip validation if we don't enable recaptcha
if ((_options.Recaptcha != null) && string.IsNullOrWhiteSpace(_options.Recaptcha.PrivateKey))
return true;
else if ((_options.Recaptcha != null) && (string.IsNullOrEmpty(recaptchaResponse) != false))
else if ((_options.Recaptcha != null) && (string.IsNullOrEmpty(recaptchaResponse) != true))
{
var requestUrl = new Uri(
$"https://www.google.com/recaptcha/api/siteverify?secret={_options.Recaptcha.PrivateKey}&response={recaptchaResponse}");
Expand Down