Skip to content

Commit 6fabc4e

Browse files
authored
Merge pull request #24 from umbraco/v8/bugfix/api-key-validation
API key validation and align naming conventions with CMS ones.
2 parents ec85e6e + 335ae4c commit 6fabc4e

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/Umbraco.Forms.Integrations.Automation.Zapier/Controllers/FormController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public FormController(ZapierFormService zapierFormService, IUserValidationServic
3232

3333
public IEnumerable<FormDto> GetForms()
3434
{
35-
if (!IsUserValid()) return Enumerable.Empty<FormDto>();
35+
if (!IsAccessValid()) return Enumerable.Empty<FormDto>();
3636

3737
return _zapierFormService.GetAll();
3838
}

src/Umbraco.Forms.Integrations.Automation.Zapier/Controllers/FormPollingController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public FormPollingController(ZapierFormService zapierFormService, IRecordStorage
4646

4747
public List<Dictionary<string, string>> GetFormPropertiesById(string id)
4848
{
49-
if (!IsUserValid()) return new List<Dictionary<string, string>>();
49+
if (!IsAccessValid()) return new List<Dictionary<string, string>>();
5050

5151
var form = _zapierFormService.GetById(id);
5252

src/Umbraco.Forms.Integrations.Automation.Zapier/Controllers/ZapierFormAuthorizedApiController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public ZapierFormAuthorizedApiController(IUserValidationService userValidationSe
3636
_userValidationService = userValidationService;
3737
}
3838

39-
public bool IsUserValid()
39+
public bool IsAccessValid()
4040
{
4141
string username = string.Empty;
4242
string password = string.Empty;
@@ -66,6 +66,9 @@ public bool IsUserValid()
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+
6972
var isAuthorized = _userValidationService.Validate(username, password, Options.ApiKey).GetAwaiter()
7073
.GetResult();
7174
if (!isAuthorized) return false;

0 commit comments

Comments
 (0)