fix: validate url starts with http or https for job form
This commit is contained in:
@@ -254,8 +254,18 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
if (props.jobName != 'new') jobDetail.reload()
|
||||
addKeyboardShortcuts()
|
||||
})
|
||||
|
||||
const addKeyboardShortcuts = () => {
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 's') {
|
||||
e.preventDefault()
|
||||
saveJob()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const saveJob = () => {
|
||||
validateJobFields()
|
||||
if (jobDetail.data) {
|
||||
@@ -359,7 +369,7 @@ const breadcrumbs = computed(() => {
|
||||
|
||||
usePageMeta(() => {
|
||||
return {
|
||||
title: props.jobName == 'new' ? 'New Job' : jobDetail.data?.title,
|
||||
title: props.jobName == 'new' ? 'New Job' : jobDetail.data?.job_title,
|
||||
icon: brand.favicon,
|
||||
}
|
||||
})
|
||||
|
||||
@@ -16,7 +16,7 @@ class JobOpportunity(Document):
|
||||
self.company_logo = validate_image(self.company_logo)
|
||||
|
||||
def validate_urls(self):
|
||||
validate_url(self.company_website, True)
|
||||
validate_url(self.company_website, True, ["http://", "https://"])
|
||||
|
||||
def autoname(self):
|
||||
if not self.name:
|
||||
|
||||
@@ -28,7 +28,7 @@ class LMSAssignmentSubmission(Document):
|
||||
)
|
||||
|
||||
def validate_url(self):
|
||||
if self.type == "URL" and not validate_url(self.answer):
|
||||
if self.type == "URL" and not validate_url(self.answer, True, ["http://", "https://"]):
|
||||
frappe.throw(_("Please enter a valid URL."))
|
||||
|
||||
def validate_status(self):
|
||||
|
||||
@@ -49,7 +49,7 @@ class LMSSettings(Document):
|
||||
def validate_contact_us_details(self):
|
||||
if self.contact_us_email and not validate_email_address(self.contact_us_email):
|
||||
frappe.throw(_("Please enter a valid Contact Us Email."))
|
||||
if self.contact_us_url and not validate_url(self.contact_us_url, True):
|
||||
if self.contact_us_url and not validate_url(self.contact_us_url, True, ["http://", "https://"]):
|
||||
frappe.throw(_("Please enter a valid Contact Us URL."))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user