Skip to content

Commit d702eeb

Browse files
committed
Merge branch 'develop'
2 parents 2399613 + 6b8123e commit d702eeb

File tree

7 files changed

+103
-45
lines changed

7 files changed

+103
-45
lines changed

assets/js/hubmanaged.js

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,21 @@ class HubManaged {
2727
data: {
2828
email: this._submitData.email
2929
}
30-
}).done(_ => {
30+
}).done(response => {
31+
// Auto-populate subdomain only if it's a company email
32+
if (response.isCompanyEmail) {
33+
this._submitData.subdomain = emailToSubdomain(this._submitData.email);
34+
} else {
35+
// Clear subdomain for non-company emails (freemail, etc.)
36+
this._submitData.subdomain = '';
37+
}
3138
this.onValidationSucceeded();
3239
}).fail(xhr => {
3340
this.onValidationFailed(xhr.responseJSON?.message || 'Validating email failed.');
3441
});
3542
}
3643

37-
validateTeamAndSubdomain() {
44+
validateSubdomain() {
3845
if (!$(this._form)[0].checkValidity()) {
3946
$(this._form).find(':input').addClass('show-invalid');
4047
this._feedbackData.errorMessage = 'Please fill in all required fields.';
@@ -47,13 +54,12 @@ class HubManaged {
4754
url: VALIDATE_HUB_MANAGED_REQUEST_URL,
4855
type: 'GET',
4956
data: {
50-
team: this._submitData.team,
5157
subdomain: this._submitData.subdomain
5258
}
5359
}).done(_ => {
5460
this.onValidationSucceeded();
5561
}).fail(xhr => {
56-
this.onValidationFailed(xhr.responseJSON?.message || 'Validating team and subdomain failed.');
62+
this.onValidationFailed(xhr.responseJSON?.message || 'Validating subdomain failed.');
5763
});
5864
}
5965

@@ -153,6 +159,73 @@ function teamToSubdomain(team) {
153159
return subdomain;
154160
}
155161

162+
function emailToSubdomain(email) {
163+
if (!email || !email.includes('@')) {
164+
return '';
165+
}
166+
167+
// Extract domain from email
168+
const domain = email.split('@')[1].toLowerCase();
169+
170+
// Extract subdomain from email domain
171+
const domainParts = domain.split('.');
172+
173+
// For domains with multiple levels, try to find the most meaningful part
174+
let subdomain = '';
175+
176+
if (domainParts.length >= 2) {
177+
// Common TLDs and country codes to ignore
178+
const tlds = ['com', 'org', 'net', 'edu', 'gov', 'mil', 'co', 'io', 'me', 'info', 'biz'];
179+
const countryCodes = ['de', 'uk', 'fr', 'es', 'it', 'nl', 'at', 'ch', 'us', 'ca', 'au', 'jp', 'cn', 'in', 'br'];
180+
181+
// For academic domains (containing .edu, .ac, .edu.*, .ac.*)
182+
if (domain.includes('.edu') || domain.includes('.ac.')) {
183+
// Try to find the institution name (usually right before .edu/.ac)
184+
for (let i = domainParts.length - 3; i >= 0; i--) {
185+
if (!tlds.includes(domainParts[i]) && !countryCodes.includes(domainParts[i])) {
186+
subdomain = domainParts[i];
187+
break;
188+
}
189+
}
190+
}
191+
192+
// If no academic pattern or no match found, use heuristics
193+
if (!subdomain) {
194+
// Skip the last part (TLD) and country code if present
195+
let skipParts = 1;
196+
if (domainParts.length > 2 && countryCodes.includes(domainParts[domainParts.length - 1])) {
197+
skipParts = 2;
198+
}
199+
200+
// Look for the most meaningful part (skip common subdomains)
201+
const commonSubdomains = ['www', 'mail', 'email', 'smtp', 'pop', 'imap', 'webmail', 'smail'];
202+
for (let i = domainParts.length - skipParts - 1; i >= 0; i--) {
203+
if (!commonSubdomains.includes(domainParts[i])) {
204+
subdomain = domainParts[i];
205+
break;
206+
}
207+
}
208+
209+
// If all parts are common subdomains, just use the first part
210+
if (!subdomain && domainParts.length > skipParts) {
211+
subdomain = domainParts[0];
212+
}
213+
}
214+
215+
// Clean up the subdomain to match the allowed pattern
216+
subdomain = subdomain.replace(/[^a-z0-9-]/g, '-');
217+
subdomain = subdomain.replace(/-+/g, '-');
218+
subdomain = subdomain.replace(/^-+|-+$/g, '');
219+
220+
// Ensure it's not empty and within length limits
221+
if (subdomain && subdomain.length <= 63) {
222+
return subdomain;
223+
}
224+
}
225+
226+
return '';
227+
}
228+
156229
function subdomainToURL(subdomain) {
157230
return `https://${subdomain}.cryptomator.cloud`;
158231
}

i18n/de.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -662,15 +662,13 @@
662662
translation: "E-Mail-Adresse"
663663

664664
- id: hub_managed_step_2_nav_title
665-
translation: "Team-Name"
665+
translation: "Subdomain"
666666
- id: hub_managed_step_2_title
667-
translation: "Wie heißt dein Team?"
668-
- id: hub_managed_step_2_team_placeholder
669-
translation: "Name deines Teams, Unternehmens oder deiner Organisation"
667+
translation: "Welche Subdomain möchtest du?"
670668
- id: hub_managed_step_2_subdomain_description
671-
translation: "Dies ist die URL deiner Hub-Instanz."
669+
translation: "Dies wird die URL deiner Hub-Instanz sein."
672670
- id: hub_managed_step_2_subdomain_placeholder
673-
translation: "Subdomain deiner Hub-Instanz"
671+
translation: "deine-subdomain"
674672

675673
- id: hub_managed_step_3_nav_title
676674
translation: "Erwartete Nutzer"
@@ -687,8 +685,6 @@
687685
translation: "Zusammenfassung"
688686
- id: hub_managed_step_4_email
689687
translation: "E-Mail"
690-
- id: hub_managed_step_4_team
691-
translation: "Team-Name"
692688
- id: hub_managed_step_4_url
693689
translation: "URL"
694690
- id: hub_managed_step_4_quantity

i18n/en.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -662,15 +662,13 @@
662662
translation: "Email address"
663663

664664
- id: hub_managed_step_2_nav_title
665-
translation: "Team Name"
665+
translation: "Subdomain"
666666
- id: hub_managed_step_2_title
667-
translation: "What's your team's name?"
668-
- id: hub_managed_step_2_team_placeholder
669-
translation: "Name of your team, company, or organization"
667+
translation: "What subdomain would you like?"
670668
- id: hub_managed_step_2_subdomain_description
671-
translation: "This is the URL of your Hub instance."
669+
translation: "This will be the URL of your Hub instance."
672670
- id: hub_managed_step_2_subdomain_placeholder
673-
translation: "Subdomain of your Hub instance"
671+
translation: "your-subdomain"
674672

675673
- id: hub_managed_step_3_nav_title
676674
translation: "Expected Users"
@@ -687,8 +685,6 @@
687685
translation: "Summary"
688686
- id: hub_managed_step_4_email
689687
translation: "Email"
690-
- id: hub_managed_step_4_team
691-
translation: "Team Name"
692688
- id: hub_managed_step_4_url
693689
translation: "URL"
694690
- id: hub_managed_step_4_quantity

layouts/become-a-partner/single.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
1818
<label for="firstName" class="block text-sm font-medium text-gray-700 mb-2">
1919
{{ i18n "partner_first_name" }} <span class="text-red-500" aria-label="required">*</span>
2020
</label>
21-
<input type="text" id="firstName" name="firstName" x-model="submitData.firstName" class="block input-box w-full" required aria-required="true" @blur="$el.classList.add('show-invalid')">
21+
<input type="text" id="firstName" name="firstName" x-model="submitData.firstName" class="block input-box w-full" maxlength="100" required aria-required="true" @blur="$el.classList.add('show-invalid')">
2222
</div>
2323

2424
<!-- Last Name -->
2525
<div>
2626
<label for="lastName" class="block text-sm font-medium text-gray-700 mb-2">
2727
{{ i18n "partner_last_name" }} <span class="text-red-500" aria-label="required">*</span>
2828
</label>
29-
<input type="text" id="lastName" name="lastName" x-model="submitData.lastName" class="block input-box w-full" required aria-required="true" @blur="$el.classList.add('show-invalid')">
29+
<input type="text" id="lastName" name="lastName" x-model="submitData.lastName" class="block input-box w-full" maxlength="100" required aria-required="true" @blur="$el.classList.add('show-invalid')">
3030
</div>
3131
</div>
3232

@@ -43,15 +43,15 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
4343
<label for="company" class="block text-sm font-medium text-gray-700 mb-2">
4444
{{ i18n "partner_company" }} <span class="text-red-500" aria-label="required">*</span>
4545
</label>
46-
<input type="text" id="company" name="company" x-model="submitData.company" class="block input-box w-full" required aria-required="true" @blur="$el.classList.add('show-invalid')">
46+
<input type="text" id="company" name="company" x-model="submitData.company" class="block input-box w-full" maxlength="200" required aria-required="true" @blur="$el.classList.add('show-invalid')">
4747
</div>
4848

4949
<!-- Company Website -->
5050
<div class="mb-6">
5151
<label for="website" class="block text-sm font-medium text-gray-700 mb-2">
5252
{{ i18n "partner_website" }}
5353
</label>
54-
<input type="url" id="website" name="website" x-model="submitData.website" class="block input-box w-full" placeholder="https://">
54+
<input type="url" id="website" name="website" x-model="submitData.website" class="block input-box w-full" maxlength="200" placeholder="https://">
5555
</div>
5656

5757
<!-- Partnership Type -->
@@ -74,7 +74,7 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
7474
<label for="message" class="block text-sm font-medium text-gray-700 mb-2">
7575
{{ i18n "partner_message" }}
7676
</label>
77-
<textarea id="message" name="message" x-model="submitData.message" rows="4" class="block input-box w-full" placeholder="{{ i18n "partner_message_placeholder" }}"></textarea>
77+
<textarea id="message" name="message" x-model="submitData.message" rows="4" class="block input-box w-full" maxlength="2000" placeholder="{{ i18n "partner_message_placeholder" }}"></textarea>
7878
</div>
7979

8080
<!-- Terms & Privacy Acceptance -->

layouts/book-a-demo/single.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
1818
<label for="firstName" class="block text-sm font-medium text-gray-700 mb-2">
1919
{{ i18n "book_demo_first_name" }} <span class="text-red-500" aria-label="required">*</span>
2020
</label>
21-
<input type="text" id="firstName" name="firstName" x-model="submitData.firstName" class="block input-box w-full" required aria-required="true" @blur="$el.classList.add('show-invalid')">
21+
<input type="text" id="firstName" name="firstName" x-model="submitData.firstName" class="block input-box w-full" maxlength="100" required aria-required="true" @blur="$el.classList.add('show-invalid')">
2222
</div>
2323

2424
<!-- Last Name -->
2525
<div>
2626
<label for="lastName" class="block text-sm font-medium text-gray-700 mb-2">
2727
{{ i18n "book_demo_last_name" }} <span class="text-red-500" aria-label="required">*</span>
2828
</label>
29-
<input type="text" id="lastName" name="lastName" x-model="submitData.lastName" class="block input-box w-full" required aria-required="true" @blur="$el.classList.add('show-invalid')">
29+
<input type="text" id="lastName" name="lastName" x-model="submitData.lastName" class="block input-box w-full" maxlength="100" required aria-required="true" @blur="$el.classList.add('show-invalid')">
3030
</div>
3131
</div>
3232

@@ -43,7 +43,7 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
4343
<label for="company" class="block text-sm font-medium text-gray-700 mb-2">
4444
{{ i18n "book_demo_company" }}
4545
</label>
46-
<input type="text" id="company" name="company" x-model="submitData.company" class="block input-box w-full">
46+
<input type="text" id="company" name="company" x-model="submitData.company" class="block input-box w-full" maxlength="200">
4747
</div>
4848

4949
<!-- What do you want to learn? -->
@@ -113,7 +113,7 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
113113
<label for="message" class="block text-sm font-medium text-gray-700 mb-2">
114114
{{ i18n "book_demo_message" }}
115115
</label>
116-
<textarea id="message" name="message" x-model="submitData.message" rows="4" class="block input-box w-full" placeholder="{{ i18n "book_demo_message_placeholder" }}"></textarea>
116+
<textarea id="message" name="message" x-model="submitData.message" rows="4" class="block input-box w-full" maxlength="2000" placeholder="{{ i18n "book_demo_message_placeholder" }}"></textarea>
117117
</div>
118118

119119
<!-- Terms & Privacy Acceptance -->

layouts/contact-sales/single.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
1818
<label for="firstName" class="block text-sm font-medium text-gray-700 mb-2">
1919
{{ i18n "contact_sales_first_name" }} <span class="text-red-500" aria-label="required">*</span>
2020
</label>
21-
<input type="text" id="firstName" name="firstName" x-model="submitData.firstName" class="block input-box w-full" required aria-required="true" @blur="$el.classList.add('show-invalid')">
21+
<input type="text" id="firstName" name="firstName" x-model="submitData.firstName" class="block input-box w-full" maxlength="100" required aria-required="true" @blur="$el.classList.add('show-invalid')">
2222
</div>
2323

2424
<!-- Last Name -->
2525
<div>
2626
<label for="lastName" class="block text-sm font-medium text-gray-700 mb-2">
2727
{{ i18n "contact_sales_last_name" }} <span class="text-red-500" aria-label="required">*</span>
2828
</label>
29-
<input type="text" id="lastName" name="lastName" x-model="submitData.lastName" class="block input-box w-full" required aria-required="true" @blur="$el.classList.add('show-invalid')">
29+
<input type="text" id="lastName" name="lastName" x-model="submitData.lastName" class="block input-box w-full" maxlength="100" required aria-required="true" @blur="$el.classList.add('show-invalid')">
3030
</div>
3131
</div>
3232

@@ -43,7 +43,7 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
4343
<label for="website" class="block text-sm font-medium text-gray-700 mb-2">
4444
{{ i18n "contact_sales_website" }}
4545
</label>
46-
<input type="url" id="website" name="website" x-model="submitData.website" class="block input-box w-full" placeholder="https://">
46+
<input type="url" id="website" name="website" x-model="submitData.website" class="block input-box w-full" maxlength="200" placeholder="https://">
4747
</div>
4848

4949
<!-- Topic Dropdown -->
@@ -65,7 +65,7 @@ <h1 class="font-h1 mb-8">{{ .Title }}</h1>
6565
<label for="message" class="block text-sm font-medium text-gray-700 mb-2">
6666
{{ i18n "contact_sales_message" }}
6767
</label>
68-
<textarea id="message" name="message" x-model="submitData.message" rows="4" class="block input-box w-full" placeholder="{{ i18n "contact_sales_message_placeholder" }}"></textarea>
68+
<textarea id="message" name="message" x-model="submitData.message" rows="4" class="block input-box w-full" maxlength="2000" placeholder="{{ i18n "contact_sales_message_placeholder" }}"></textarea>
6969
</div>
7070

7171
<!-- Terms & Privacy Acceptance -->

0 commit comments

Comments
 (0)