Skip to content

Commit

Permalink
Added new email form type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Zalewski committed Nov 8, 2023
1 parent 5cee740 commit 44f27c8
Show file tree
Hide file tree
Showing 9 changed files with 1,261 additions and 1,330 deletions.
1 change: 1 addition & 0 deletions .frontmatter/database/taxonomyDb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"frontMatter.framework.id": "docusaurus",
"frontMatter.content.publicFolder": "static",
"frontMatter.preview.host": "http://localhost:3000"
"frontMatter.preview.host": "http://localhost:3000",
"editor.acceptSuggestionOnEnter": "off"
}
2 changes: 1 addition & 1 deletion docs
Submodule docs updated from ce946f to eeb02d
16 changes: 6 additions & 10 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"hosting": {
"public": "www",
"trailingSlash": false,
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"headers": [
{
"source": "**/*",
Expand Down Expand Up @@ -81,22 +77,22 @@
"redirects": [
{
"source": "/start",
"destination": "https://gitlab.com/megabyte-labs/install.doctor/-/raw/master/local/provision.sh",
"destination": "https://raw.githubusercontent.com/megabyte-labs/install.doctor/master/local/provision.sh",
"type": 301
},
{
"source": "/windows",
"destination": "https://gitlab.com/megabyte-labs/install.doctor/-/raw/master/local/provision.ps1",
"destination": "https://raw.githubusercontent.com/megabyte-labs/install.doctor/master/scripts/provision.sh",
"type": 301
},
{
"source": "/vagrant",
"destination": "https://gitlab.com/megabyte-labs/install.doctor/-/raw/master/local/vagrant.sh",
"destination": "https://raw.githubusercontent.com/megabyte-labs/install.doctor/master/scripts/provision.sh",
"type": 301
},
{
"source": "/vagrant-windows",
"destination": "https://gitlab.com/megabyte-labs/install.doctor/-/raw/master/local/vagrant.ps1",
"destination": "https://raw.githubusercontent.com/megabyte-labs/install.doctor/master/scripts/provision.sh",
"type": 301
},
{
Expand All @@ -106,4 +102,4 @@
}
]
}
}
}
17 changes: 17 additions & 0 deletions pages/blog/pfsense-jumpcloud.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
---
title: Integrating JumpCloud with pfSense
slug: pfsense-jumpcloud
date: 2023-08-07 14:00:00
author: Brian Zalewski <brian@megabyte.space>
authorUrl: https://twitter.com/HillBillyHack3r
authorName: Brian Zalewski
authorImageName: brian-zalewski.png
authorDescription: Hey, my name is Brian. My friends call me BZ. I am the main driving force behind Megabyte Labs and its various offerings. Apart from optimizing my developer tool stack, my hobbies include going to the gym, partying with friends, and playing volleyball / kickball. I never turn down a conversation about AI, God, time travelers, or Jesus. I frequently think about how I can make the world a better place by inspiring others.
description: Instructions on how to configure pfSense to work with JumpCloud
featuredImage: /self-service-portal.png
featuredImageAlt: pfSense JumpCloud graphic
tags: pfSense,JumpCloud,LDAP
---

Acquire certificate required for connecting JumpCloud to pfSense.

JumpCloud LDAPS Certificate (goes under Certificates tab)
Expand All @@ -8,4 +23,6 @@ echo -n | openssl s_client -connect ldap.jumpcloud.com:636 | sed -ne '/-BEGIN CE

Certificate Authority (goes under CAs tab)

```shell
echo -n | openssl s_client -connect ldap.jumpcloud.com:636 -showcerts | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/jumpcloud.chain.pem
```
138 changes: 53 additions & 85 deletions src/components/capacitor-site-footer/capacitor-site-footer.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import { Component, Host, State, h, Fragment, Prop } from '@stencil/core'
import { href } from '@stencil/router'
import { defaults } from '../../store'
import {
ResponsiveContainer,
Grid,
Col,
Heading,
Paragraph,
} from 'ionic-ds-no-fonts'
import { Component, Host, State, h, Fragment, Prop } from '@stencil/core';
import { href } from '@stencil/router';
import { defaults } from '../../store';
import { ResponsiveContainer, Grid, Col, Heading, Paragraph } from 'ionic-ds-no-fonts';

declare global {
interface Window {
hbspt: {
forms: {
create: ({ }) => any
}
}
create: ({}) => any;
};
};
}
}

Expand All @@ -24,45 +18,41 @@ declare global {
styleUrl: 'capacitor-site-footer.scss',
})
export class CapacitorSiteFooter {
@Prop() defaults: typeof defaults
@Prop() defaults: typeof defaults;
@State() email: string = '';
@State() isLoading: boolean = false;
@State() hasSubmitted: boolean = false;
@State() isValid: boolean = true;
@State() inlineMessage: string = '';

componentWillLoad() { }
componentWillLoad() {}

handleNewsletterSubmit(e: Event) {
e.preventDefault()
e.preventDefault();

this.isLoading = true
this.isLoading = true;

const xhr = new XMLHttpRequest()
const url = [
'https://api.hsforms.com/submissions/v3/integration/submit',
this.defaults.hubspot.emailForm.id,
this.defaults.hubspot.emailForm.key,
].join('/')
xhr.open('POST', url)
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8')
const xhr = new XMLHttpRequest();
const url = this.defaults.emailForm.url;

xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) {
const json = JSON.parse(xhr.responseText)
this.inlineMessage = json.inlineMessage
this.isLoading = false
this.hasSubmitted = true
this.isValid = true
const json = JSON.parse(xhr.responseText);
this.inlineMessage = json.inlineMessage;
this.isLoading = false;
this.hasSubmitted = true;
this.isValid = true;
} else if (xhr.readyState == 4 && xhr.status == 400) {
this.inlineMessage = 'Please enter a valid e-mail address.'
this.isLoading = false
this.isValid = false
this.inlineMessage = 'Please enter a valid e-mail address.';
this.isLoading = false;
this.isValid = false;
}
}
};

const hutkMatch =
document.cookie.match && document.cookie.match(/hubspotutk=(.*?);/)
const hutk = hutkMatch ? hutkMatch[1] : undefined
const hutkMatch = document.cookie.match && document.cookie.match(/hubspotutk=(.*?);/);
const hutk = hutkMatch ? hutkMatch[1] : undefined;

xhr.send(
JSON.stringify({
Expand All @@ -82,34 +72,37 @@ export class CapacitorSiteFooter {
pageUri: window.location.href,
pageName: document.title,
},
}),
)
})
);
}

handleEmailChange(ev: any) {
this.email = ev.target.value
this.isValid = true
this.email = ev.target.value;
this.isValid = true;
}

handleInlineMessage(returnMessage: string) {
const messageMatch =
returnMessage.match && returnMessage.match(/<p>(.*?)<\/p>/)
return messageMatch ? messageMatch[1] : undefined
const messageMatch = returnMessage.match && returnMessage.match(/<p>(.*?)<\/p>/);
return messageMatch ? messageMatch[1] : undefined;
}

companyLink() {
if (this.defaults.companyUrl !== this.defaults.homepage) {
return (
<Fragment>
<a href={this.defaults.companyUrl} target="_blank" rel="noopener">{this.defaults.companyFooterBrandName}</a> | Released under <span id="mit">{this.defaults.license} License</span>
<a href={this.defaults.companyUrl} target="_blank" rel="noopener">
{this.defaults.companyFooterBrandName}
</a>{' '}
| Released under <span id="mit">{this.defaults.license} License</span>
</Fragment>
)
);
} else {
return (
<Fragment>
<a {...href('/')}>{this.defaults.companyFooterBrandName}</a> | Released under <span id="mit">{this.defaults.license} License</span>
<a {...href('/')}>{this.defaults.companyFooterBrandName}</a> | Released under{' '}
<span id="mit">{this.defaults.license} License</span>
</Fragment>
)
);
}
}

Expand All @@ -129,12 +122,10 @@ export class CapacitorSiteFooter {
{this.hasSubmitted ? (
<div class="form-message">
<ion-icon name="checkmark-circle"></ion-icon>
<Paragraph>
{this.handleInlineMessage(this.inlineMessage)}
</Paragraph>
<Paragraph>{this.handleInlineMessage(this.inlineMessage)}</Paragraph>
</div>
) : (
<form class="hs-form" onSubmit={e => this.handleNewsletterSubmit(e)}>
<form class="hs-form" onSubmit={(e) => this.handleNewsletterSubmit(e)}>
<div class="hs_email hs-email hs-fieldtype-text field hs-form-field">
<div class="input">
<input
Expand All @@ -146,7 +137,7 @@ export class CapacitorSiteFooter {
onInput={() => this.handleEmailChange(event)}
disabled={this.isLoading}
placeholder="E-mail"
class={{ 'error': this.isValid, 'ui-paragraph-4': true }}
class={{ error: this.isValid, 'ui-paragraph-4': true }}
aria-label="Email"
required
/>
Expand Down Expand Up @@ -200,14 +191,14 @@ export class CapacitorSiteFooter {
<ion-icon name="logo-youtube"></ion-icon>
</a>
</div>
<p>© {new Date().getFullYear()} {this.defaults.companyLegalName}</p>
<p>
{this.companyLink()}
© {new Date().getFullYear()} {this.defaults.companyLegalName}
</p>
<p>{this.companyLink()}</p>
<p>
<a {...href('/privacy')}>Privacy Policy</a> | <a {...href('/terms')}>Terms of Service</a>
</p>
</Col >
</Col>
<Col md={6} sm={8} xs={12} cols={12}>
<div class="routes-group">
<div>
Expand All @@ -226,10 +217,7 @@ export class CapacitorSiteFooter {
<Heading level={5}>Resources</Heading>
<ul class="routes">
<li>
<a
class="ui-paragraph-4"
href="/blog"
>
<a class="ui-paragraph-4" href="/blog">
Blog
</a>
</li>
Expand Down Expand Up @@ -259,42 +247,22 @@ export class CapacitorSiteFooter {
<Heading level={5}>Connect</Heading>
<ul class="routes">
<li>
<a
class="ui-paragraph-4"
href={this.defaults.social.github}
target="_blank"
rel="noopener"
>
<a class="ui-paragraph-4" href={this.defaults.social.github} target="_blank" rel="noopener">
GitHub
</a>
</li>
<li>
<a
class="ui-paragraph-4"
href={this.defaults.social.gitlab}
target="_blank"
rel="noopener"
>
<a class="ui-paragraph-4" href={this.defaults.social.gitlab} target="_blank" rel="noopener">
GitLab
</a>
</li>
<li>
<a
class="ui-paragraph-4"
href={this.defaults.social.facebook}
target="_blank"
rel="noopener"
>
<a class="ui-paragraph-4" href={this.defaults.social.facebook} target="_blank" rel="noopener">
Facebook
</a>
</li>
<li>
<a
class="ui-paragraph-4"
href={this.defaults.social.twitter}
target="_blank"
rel="noopener"
>
<a class="ui-paragraph-4" href={this.defaults.social.twitter} target="_blank" rel="noopener">
Twitter
</a>
</li>
Expand All @@ -306,6 +274,6 @@ export class CapacitorSiteFooter {
</ResponsiveContainer>
</footer>
</Host>
)
);
}
}

0 comments on commit 44f27c8

Please sign in to comment.