Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(auth): accept Gmail in mobile email capture (#9023)

Jacob Beckerman9527249b2866
diff --git a/apps/marketing/src/app/components/forms/FormMobileSignup.tsx b/apps/marketing/src/app/components/forms/FormMobileSignup.tsx
index a002297e3e..ee36407dd8 100644
--- a/apps/marketing/src/app/components/forms/FormMobileSignup.tsx
+++ b/apps/marketing/src/app/components/forms/FormMobileSignup.tsx
@@ -178,28 +178,33 @@ export function FormMobileSignup(props: FormMobileSignupProps) {
spellcheck={false}
aria-label="Email address"
aria-invalid={error() ? 'true' : undefined}
- placeholder={props.placeholder ?? 'Your work email'}
+ placeholder={props.placeholder ?? 'Your work email or Gmail'}
value={email()}
onInput={(event) => {
setEmail(event.currentTarget.value);
if (error()) setError(null);
}}
- style={card() ? undefined : {
- 'background-color':
- 'color-mix(in srgb, var(--b1) 88%, transparent)',
- border: '1px solid color-mix(in srgb, var(--b4) 46%, transparent)',
- 'border-radius': '999px',
- 'box-sizing': 'border-box',
- color: 'var(--c0)',
- 'font-family': 'body',
- // 16px minimum: iOS Safari zooms the page when focusing a smaller field.
- 'font-size': '16px',
- height: inline() ? '32px' : '46px',
- outline: 'none',
- padding: inline() ? '0 96px 0 14px' : '0 18px',
- transition: 'border-color 160ms ease',
- width: '100%',
- }}
+ style={
+ card()
+ ? undefined
+ : {
+ 'background-color':
+ 'color-mix(in srgb, var(--b1) 88%, transparent)',
+ border:
+ '1px solid color-mix(in srgb, var(--b4) 46%, transparent)',
+ 'border-radius': '999px',
+ 'box-sizing': 'border-box',
+ color: 'var(--c0)',
+ 'font-family': 'body',
+ // 16px minimum: iOS Safari zooms the page when focusing a smaller field.
+ 'font-size': '16px',
+ height: inline() ? '32px' : '46px',
+ outline: 'none',
+ padding: inline() ? '0 96px 0 14px' : '0 18px',
+ transition: 'border-color 160ms ease',
+ width: '100%',
+ }
+ }
/>
<button
@@ -212,38 +217,42 @@ export function FormMobileSignup(props: FormMobileSignupProps) {
}
type="submit"
disabled={pending()}
- style={card() ? undefined : {
- 'align-items': 'center',
- 'background-color': 'var(--c1)',
- border: '1px solid transparent',
- 'border-radius': '999px',
- 'box-sizing': 'border-box',
- color: 'var(--b0)',
- cursor: 'default',
- display: 'inline-flex',
- 'font-family': 'body',
- 'font-size': inline() ? '13px' : '16px',
- 'font-weight': '700',
- ...(inline()
- ? {
- bottom: 'auto',
- height: '26px',
- padding: '0 12px',
- position: 'absolute',
- right: '3px',
- top: '50%',
- transform: 'translateY(-50%)',
- }
+ style={
+ card()
+ ? undefined
: {
- height: '46px',
- padding: '0 22px',
- width: '100%',
- }),
- 'justify-content': 'center',
- 'letter-spacing': '0.01em',
- 'line-height': 1,
- 'white-space': 'nowrap',
- }}
+ 'align-items': 'center',
+ 'background-color': 'var(--c1)',
+ border: '1px solid transparent',
+ 'border-radius': '999px',
+ 'box-sizing': 'border-box',
+ color: 'var(--b0)',
+ cursor: 'default',
+ display: 'inline-flex',
+ 'font-family': 'body',
+ 'font-size': inline() ? '13px' : '16px',
+ 'font-weight': '700',
+ ...(inline()
+ ? {
+ bottom: 'auto',
+ height: '26px',
+ padding: '0 12px',
+ position: 'absolute',
+ right: '3px',
+ top: '50%',
+ transform: 'translateY(-50%)',
+ }
+ : {
+ height: '46px',
+ padding: '0 22px',
+ width: '100%',
+ }),
+ 'justify-content': 'center',
+ 'letter-spacing': '0.01em',
+ 'line-height': 1,
+ 'white-space': 'nowrap',
+ }
+ }
>
{buttonLabel()}
</button>
diff --git a/apps/marketing/src/app/utils/utilMobileSignup.ts b/apps/marketing/src/app/utils/utilMobileSignup.ts
index 2a3b23de8c..fe2ee60c9a 100644
--- a/apps/marketing/src/app/utils/utilMobileSignup.ts
+++ b/apps/marketing/src/app/utils/utilMobileSignup.ts
@@ -80,7 +80,7 @@ export const isLikelyEmail = (value: string): boolean =>
/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value);
/** Must match `SendMobileWelcomeEmailError::PersonalEmail` in the auth service. */
-const WORK_EMAIL_REQUIRED = 'Please use your work email';
+const WORK_EMAIL_REQUIRED = 'Please use your work email or Gmail';
export type MobileSignupResult = { ok: true } | { ok: false; message: string };
diff --git a/services/authentication_service/src/api/mobile_welcome_email.rs b/services/authentication_service/src/api/mobile_welcome_email.rs
index e3e675032f..4994fa97a3 100644
--- a/services/authentication_service/src/api/mobile_welcome_email.rs
+++ b/services/authentication_service/src/api/mobile_welcome_email.rs
@@ -22,7 +22,7 @@ pub enum SendMobileWelcomeEmailError {
#[error("Email is blocked")]
EmailBlocked,
- #[error("Please use your work email")]
+ #[error("Please use your work email or Gmail")]
PersonalEmail,
#[error("Internal error")]
@@ -172,11 +172,17 @@ pub async fn handler(
Ok(Json(SendMobileWelcomeEmailResponse { sent: true }))
}
+/// Gmail domains accepted despite being generic: Macro connects Gmail inboxes,
+/// so a Gmail lead can finish signing up on desktop.
+const ALLOWED_PERSONAL_DOMAINS: &[&str] = &["gmail.com", "googlemail.com"];
+
fn is_personal_email(email: &str) -> bool {
- email
- .trim()
- .rsplit_once('@')
- .is_some_and(|(_, domain)| generic_email_domains::is_generic_email_domain(domain))
+ email.trim().rsplit_once('@').is_some_and(|(_, domain)| {
+ generic_email_domains::is_generic_email_domain(domain)
+ && !ALLOWED_PERSONAL_DOMAINS
+ .iter()
+ .any(|allowed| domain.eq_ignore_ascii_case(allowed))
+ })
}
/// Desktop signup page. The local frontend origin has no `/app` prefix.
@@ -260,10 +266,12 @@ mod tests {
}
#[test]
- fn personal_email_providers_are_rejected() {
- assert!(is_personal_email("[email protected]"));
- assert!(is_personal_email(" [email protected] "));
+ fn personal_email_providers_other_than_gmail_are_rejected() {
+ assert!(!is_personal_email("[email protected]"));
+ assert!(!is_personal_email(" [email protected] "));
+ assert!(!is_personal_email("[email protected]"));
assert!(is_personal_email("[email protected]"));
+ assert!(is_personal_email(" [email protected] "));
assert!(!is_personal_email("[email protected]"));
assert!(!is_personal_email("[email protected]"));
}