Skip to content

Commit 8d4841d

Browse files
Ban .edu email domains in pricing form validation (#1445)
* Ban .edu email domains in pricing form validation - Add generalized .edu domain validation using endswith('.edu') check - Prevents educational institution emails from being submitted in demo request form - Maintains existing banned domain validation for consumer email providers - Uses pattern matching instead of hardcoding specific university domains Co-Authored-By: Alek <[email protected]> * Fix formatting issues with ruff - Run ruff format to fix code formatting - Fix import sorting in header.py - Address pre-commit hook formatting requirements Co-Authored-By: Alek <[email protected]> * Fix formatting for all files affected by ruff format - Apply ruff formatting to all modified files - Address remaining pre-commit formatting requirements - Ensure consistent code style across codebase Co-Authored-By: Alek <[email protected]> * Update .edu domain validation to catch domains with .edu in middle - Change from domain.endswith('.edu') to '.edu' in domain - Now catches domains like 'uncp.edu.pe' where .edu appears in middle - Tested locally: rejects [email protected], allows [email protected] - Addresses user feedback for more comprehensive .edu blocking Co-Authored-By: Alek <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Alek <[email protected]>
1 parent e3b726a commit 8d4841d

File tree

16 files changed

+179
-100
lines changed

16 files changed

+179
-100
lines changed

pcweb/components/docpage/sidebar/sidebar.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
});
4444
"""
4545

46+
4647
def sidebar_link(*children, **props):
4748
"""Create a sidebar link that closes the sidebar when clicked."""
4849
return rx.link(
@@ -177,7 +178,9 @@ def sidebar_item_comp(
177178
class_name="font-small",
178179
),
179180
rx.box(class_name="flex-grow"),
180-
rx.accordion.icon(class_name="size-4 !text-slate-9 group-hover:!text-violet-9"),
181+
rx.accordion.icon(
182+
class_name="size-4 !text-slate-9 group-hover:!text-violet-9"
183+
),
181184
class_name="!px-0 flex items-center !bg-transparent !hover:bg-transparent !py-2 !pr-0 w-full !text-slate-9 aria-expanded:text-slate-11 hover:!text-slate-11 transition-color group",
182185
),
183186
),
@@ -546,9 +549,7 @@ def sidebar_comp(
546549
rx.link( # pyright: ignore [reportCallIssue]
547550
rx.box( # pyright: ignore [reportCallIssue]
548551
rx.box( # pyright: ignore [reportCallIssue]
549-
rx.icon(
550-
"atom", size=16
551-
), # pyright: ignore [reportCallIssue]
552+
rx.icon("atom", size=16), # pyright: ignore [reportCallIssue]
552553
rx.el.h5(
553554
"Custom Components",
554555
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",
@@ -586,9 +587,7 @@ def sidebar_comp(
586587
rx.link( # pyright: ignore [reportCallIssue]
587588
rx.box( # pyright: ignore [reportCallIssue]
588589
rx.box( # pyright: ignore [reportCallIssue]
589-
rx.icon(
590-
"atom", size=16
591-
), # pyright: ignore [reportCallIssue]
590+
rx.icon("atom", size=16), # pyright: ignore [reportCallIssue]
592591
rx.el.h5(
593592
"Reflex Enterprise",
594593
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",

pcweb/components/icons/patterns.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def index_patterns() -> rx.Component:
5959
),
6060
]
6161

62+
6263
def landing_patterns() -> rx.Component:
6364
return [
6465
rx.box(
@@ -72,6 +73,7 @@ def landing_patterns() -> rx.Component:
7273
),
7374
]
7475

76+
7577
def hosting_patterns() -> rx.Component:
7678
return [
7779
rx.image(

pcweb/flexdown.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def render(self, env) -> rx.Component:
279279
),
280280
)
281281

282+
282283
class DemoOnly(flexdown.blocks.Block):
283284
"""A block that displays only a component demo without showing the code."""
284285

pcweb/pages/blog/blog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from pcweb.components.icons.icons import get_icon
77
from pcweb.meta.meta import create_meta_tags
88

9+
910
def first_post_card(meta: dict, path: str) -> rx.Component:
1011
return rx.link(
1112
rx.box(

pcweb/pages/customers/views/bento_cards.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,3 @@ def _card(company: str, is_company: bool = True, **kwarg) -> rx.Component:
145145
class_name="shrink-0 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-[1] pointer-events-none w-[15rem] h-[15rem]",
146146
),
147147
)
148-
149-

pcweb/pages/customers/views/footer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
from pcweb.pages.framework.views.footer_index import dark_mode_toggle
3232

33+
3334
def footer_link(text: str, href: str) -> rx.Component:
3435
return rx.link(
3536
text,

pcweb/pages/databricks/databricks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
document = flexdown.parse_file("pcweb/pages/databricks/databricks.md")
88

9+
910
def databricks_content() -> rx.Component:
1011
return rx.box(xd.render(document, document.filename))
1112

13+
1214
@highlight_page(path="/databricks", title="Databricks - Reflex")
1315
def databricks_page():
1416
return databricks_content()

pcweb/pages/docs/env_vars.py

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for documenting Reflex environment variables."""
2+
23
from __future__ import annotations
34

45
import inspect
@@ -12,70 +13,86 @@
1213

1314
class EnvVarDocs:
1415
"""Documentation for Reflex environment variables."""
15-
16+
1617
@classmethod
1718
def get_all_env_vars(cls) -> List[Tuple[str, Any]]:
1819
"""Get all environment variables from the environment class.
19-
20+
2021
Returns:
2122
A list of tuples containing the environment variable name and its EnvVar instance.
2223
"""
2324
env_vars = []
2425
for name, attr in inspect.getmembers(EnvironmentVariables):
25-
if name.startswith('_') or not hasattr(attr, 'name'):
26+
if name.startswith("_") or not hasattr(attr, "name"):
2627
continue
2728
env_vars.append((name, attr))
2829
return env_vars
29-
30+
3031
@classmethod
3132
def get_env_var_docstring(cls, name: str) -> Optional[str]:
3233
"""Get the docstring for an environment variable.
33-
34+
3435
Args:
3536
name: The name of the environment variable.
36-
37+
3738
Returns:
3839
The docstring for the environment variable, or None if not found.
3940
"""
4041
source_code = inspect.getsource(EnvironmentVariables)
4142
lines = source_code.splitlines()
42-
43+
4344
for i, line in enumerate(lines):
4445
if f"{name}:" in line and "EnvVar" in line:
4546
j = i - 1
4647
comments = []
47-
while j >= 0 and lines[j].strip().startswith('#'):
48+
while j >= 0 and lines[j].strip().startswith("#"):
4849
comments.insert(0, lines[j].strip()[1:].strip())
4950
j -= 1
5051
if comments:
5152
return "\n".join(comments)
5253
return None
53-
54+
5455
@classmethod
5556
def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component:
5657
"""Generate a table of environment variables.
57-
58+
5859
Args:
5960
include_internal: Whether to include internal environment variables.
60-
61+
6162
Returns:
6263
A Reflex component containing the table.
6364
"""
6465
env_vars = cls.get_all_env_vars()
65-
66+
6667
if not include_internal:
67-
env_vars = [(name, var) for name, var in env_vars if not getattr(var, 'internal', False)]
68-
68+
env_vars = [
69+
(name, var)
70+
for name, var in env_vars
71+
if not getattr(var, "internal", False)
72+
]
73+
6974
env_vars.sort(key=lambda x: x[0])
70-
75+
7176
return rx.box(
7277
rx.table.root(
7378
rx.table.header(
7479
rx.table.row(
75-
rx.table.column_header_cell("Name", class_name="font-small text-slate-12 text-normal w-[20%] justify-start pl-4 font-bold"),
76-
rx.table.column_header_cell("Type", class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold"),
77-
rx.table.column_header_cell("Default", class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold"),
78-
rx.table.column_header_cell("Description", class_name="font-small text-slate-12 text-normal w-[50%] justify-start pl-4 font-bold"),
80+
rx.table.column_header_cell(
81+
"Name",
82+
class_name="font-small text-slate-12 text-normal w-[20%] justify-start pl-4 font-bold",
83+
),
84+
rx.table.column_header_cell(
85+
"Type",
86+
class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold",
87+
),
88+
rx.table.column_header_cell(
89+
"Default",
90+
class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold",
91+
),
92+
rx.table.column_header_cell(
93+
"Description",
94+
class_name="font-small text-slate-12 text-normal w-[50%] justify-start pl-4 font-bold",
95+
),
7996
)
8097
),
8198
rx.table.body(
@@ -86,7 +103,14 @@ def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component:
86103
class_name="w-[20%]",
87104
),
88105
rx.table.cell(
89-
rx.code(str(var.type_.__name__ if hasattr(var.type_, "__name__") else str(var.type_)), class_name="code-style"),
106+
rx.code(
107+
str(
108+
var.type_.__name__
109+
if hasattr(var.type_, "__name__")
110+
else str(var.type_)
111+
),
112+
class_name="code-style",
113+
),
90114
class_name="w-[15%]",
91115
),
92116
rx.table.cell(
@@ -110,13 +134,15 @@ def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component:
110134

111135
def env_vars_page():
112136
"""Generate the environment variables documentation page.
113-
137+
114138
Returns:
115139
A Reflex component containing the documentation.
116140
"""
117141
return rx.box(
118142
h1_comp(text="Environment Variables"),
119-
rx.code("reflex.config.EnvironmentVariables", class_name="code-style text-[18px]"),
143+
rx.code(
144+
"reflex.config.EnvironmentVariables", class_name="code-style text-[18px]"
145+
),
120146
rx.divider(),
121147
markdown(
122148
"""
@@ -131,5 +157,9 @@ def env_vars_page():
131157
)
132158

133159

134-
env_vars_doc = docpage("/docs/api-reference/environment-variables/", "Environment Variables", right_sidebar=False)(env_vars_page)
160+
env_vars_doc = docpage(
161+
"/docs/api-reference/environment-variables/",
162+
"Environment Variables",
163+
right_sidebar=False,
164+
)(env_vars_page)
135165
env_vars_doc.title = "Environment Variables"

pcweb/pages/framework/views/open_source.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
from pcweb.constants import GITHUB_STARS, CONTRIBUTION_URL, BUGS_URL
44

55

6-
7-
86
def stat(icon: str, stat: str, text: str) -> rx.Component:
97
return rx.box(
108
get_icon(icon),

pcweb/pages/landing/views/companies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"apple",
1313
"microsoft",
1414
"amazon",
15-
"fastly",
15+
"fastly",
1616
"accenture",
1717
"ibm",
1818
"unicef",
@@ -95,7 +95,7 @@ def quote_box(company: str) -> rx.Component:
9595
case_study = companies_case_studies_var[company]
9696
return rx.fragment(
9797
rx.text(
98-
f'{case_study["quote"]}',
98+
f"{case_study['quote']}",
9999
class_name="text-xs text-slate-12 italic font-medium animate-fade animate-duration-[750ms] animate-fill-both",
100100
),
101101
rx.box(

0 commit comments

Comments
 (0)