refactor: access token is now a password field

This commit is contained in:
Hussain Nagaria 2025-09-30 19:36:44 +05:30
parent 5e5929ef40
commit f435d74d0a
3 changed files with 7 additions and 6 deletions

View File

@ -36,8 +36,9 @@
}, },
{ {
"fieldname": "access_token", "fieldname": "access_token",
"fieldtype": "Small Text", "fieldtype": "Password",
"label": "Access Token" "label": "Access Token",
"length": 500
}, },
{ {
"depends_on": "eval:doc.type===\"Facebook\"", "depends_on": "eval:doc.type===\"Facebook\"",
@ -72,7 +73,7 @@
"grid_page_length": 50, "grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2025-09-29 19:54:24.841414", "modified": "2025-09-30 19:31:57.730618",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Lead Syncing", "module": "Lead Syncing",
"name": "Lead Sync Source", "name": "Lead Sync Source",

View File

@ -25,7 +25,7 @@ class LeadSyncSource(Document):
if TYPE_CHECKING: if TYPE_CHECKING:
from frappe.types import DF from frappe.types import DF
access_token: DF.SmallText | None access_token: DF.Password | None
enabled: DF.Check enabled: DF.Check
facebook_lead_form: DF.Link | None facebook_lead_form: DF.Link | None
facebook_page: DF.Link | None facebook_page: DF.Link | None
@ -42,7 +42,7 @@ class LeadSyncSource(Document):
@frappe.whitelist() @frappe.whitelist()
def sync_leads(self): def sync_leads(self):
if self.type == "Facebook" and self.access_token: if self.type == "Facebook" and self.access_token:
sync_leads_from_facebook(self.access_token, self.facebook_lead_form) sync_leads_from_facebook(self.get_password("access_token"), self.facebook_lead_form)
def sync_leads_from_facebook(access_token: str, lead_form_id: str) -> None: def sync_leads_from_facebook(access_token: str, lead_form_id: str) -> None:

View File

@ -5,7 +5,7 @@ export const supportedSourceTypes = [
{ {
name: 'Facebook', name: 'Facebook',
icon: LogoFacebook, icon: LogoFacebook,
link: 'https://support.google.com/accounts/answer/185833', link: 'https://www.facebook.com/business/help/503306463479099?id=2190812977867143',
custom: false, custom: false,
} }
] ]