Skip to content

Commit 9c9925b

Browse files
authored
Merge pull request #145 from umbraco/bugfix/zapier-auth-fix
Bugfix/zapier auth fix
2 parents de34696 + 715055c commit 9c9925b

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

src/Umbraco.Cms.Integrations.Automation.Zapier/Controllers/ZapierAuthorizedApiController.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ public bool IsAccessValid()
6666

6767
if (string.IsNullOrEmpty(apiKey) && (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))) return false;
6868

69-
if (!string.IsNullOrEmpty(apiKey))
70-
return apiKey == Options.ApiKey;
71-
72-
var isAuthorized = _userValidationService.Validate(username, password, Options.ApiKey).GetAwaiter()
69+
var isAuthorized = _userValidationService.Validate(username, password, apiKey).GetAwaiter()
7370
.GetResult();
7471
if (!isAuthorized) return false;
7572

src/Umbraco.Cms.Integrations.Automation.Zapier/Services/UserValidationService.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,10 @@ public async Task<bool> Validate(string username, string password, string apiKey
7272
/// </summary>
7373
/// <param name="apiKey">Provided API key in the Zap authentication.</param>
7474
/// <returns></returns>
75-
private bool ValidateByApiKey(string apiKey)
76-
{
77-
// Check API key from CMS settings, if none, check Forms settings
78-
if (!string.IsNullOrEmpty(_zapierSettings.ApiKey))
79-
return apiKey == _zapierSettings.ApiKey;
80-
else if (!string.IsNullOrEmpty(_zapierFormsSettings.ApiKey))
81-
return apiKey == _zapierFormsSettings.ApiKey;
82-
83-
return false;
84-
}
75+
private bool ValidateByApiKey(string apiKey) =>
76+
// Check API key from CMS and Forms settings.
77+
(!string.IsNullOrEmpty(_zapierSettings.ApiKey) && _zapierSettings.ApiKey == apiKey)
78+
|| (!string.IsNullOrEmpty(_zapierFormsSettings.ApiKey) && _zapierFormsSettings.ApiKey == apiKey);
8579

8680
/// <summary>
8781
/// Validates user based on provided credentials.

src/Umbraco.Cms.Integrations.Automation.Zapier/Umbraco.Cms.Integrations.Automation.Zapier.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<RepositoryUrl>https://github.com/umbraco/Umbraco.Cms.Integrations</RepositoryUrl>
1010
<PackageProjectUrl>https://github.com/umbraco/Umbraco.Cms.Integrations/blob/main/src/Umbraco.Cms.Integrations.Automation.Zapier</PackageProjectUrl>
1111
<Product>Umbraco.Cms.Integrations.Automation.Zapier</Product>
12-
<Version>1.2.0</Version>
12+
<Version>1.2.1</Version>
1313
<PackageTags>Umbraco;Umbraco-Marketplace</PackageTags>
1414
<PackageIcon>zapier.png</PackageIcon>
1515
<PackageReadmeFile>readme.md</PackageReadmeFile>

0 commit comments

Comments
 (0)