mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
feat(Mautic Node): Add credential test and allow trailing slash in host (#3080)
* Updated Mautic to stop trailing slashes from causing an issue * Fixed oauth failing when there is a trailing slash in the mautic host * Added credential test
This commit is contained in:
committed by
GitHub
parent
984f62df9e
commit
0a75539cc3
@@ -3,8 +3,12 @@ import {
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialsDecrypted,
|
||||
ICredentialTestFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeCredentialTestResult,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
@@ -17,6 +21,7 @@ import {
|
||||
import {
|
||||
mauticApiRequest,
|
||||
mauticApiRequestAllItems,
|
||||
validateCredentials,
|
||||
validateJSON,
|
||||
} from './GenericFunctions';
|
||||
|
||||
@@ -80,6 +85,7 @@ export class Mautic implements INodeType {
|
||||
],
|
||||
},
|
||||
},
|
||||
testedBy: 'mauticCredentialTest',
|
||||
},
|
||||
{
|
||||
name: 'mauticOAuth2Api',
|
||||
@@ -166,6 +172,29 @@ export class Mautic implements INodeType {
|
||||
};
|
||||
|
||||
methods = {
|
||||
credentialTest: {
|
||||
async mauticCredentialTest(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
||||
try {
|
||||
let responseData;
|
||||
responseData = await validateCredentials.call(this, credential.data as ICredentialDataDecryptedObject);
|
||||
if (responseData.id) {
|
||||
return {
|
||||
status: 'OK',
|
||||
message: 'Authentication successful!',
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
status: 'Error',
|
||||
message: 'Invalid credentials',
|
||||
};
|
||||
}
|
||||
return {
|
||||
status: 'Error',
|
||||
message: 'Invalid credentials',
|
||||
};
|
||||
},
|
||||
},
|
||||
loadOptions: {
|
||||
// Get all the available companies to display them to user so that he can
|
||||
// select them easily
|
||||
|
||||
Reference in New Issue
Block a user