Create a local password to secure this offline account.
'''
form_id = "register-form"
else:
fields = '''
Enter your local account password.
'''
form_id = "sign-in-form"
primary = f''
verify = '''''' if signup else ""
mode = "signup" if signup else "signin"
step = "email-step" if email_step else "options-step"
heading = ("Sign up with email" if signup else "Sign in with email") if email_step else title
back = f'Back to sign {"up" if signup else "in"} options' if email_step else ""
submit = f'' if email_step else ""
if write_intent:
detail = '''
By clicking “Create Account”, you accept Medium's Terms of Service and Privacy Policy. This site uses reCaptcha and the Google Privacy Policy and Terms of Service apply.'''
elif signup:
detail = '''
By clicking “Sign in”, you accept Medium's Terms of Service and Privacy Policy.'''
modal_class = (
"write-intent"
if write_intent
else ("signup-intent" if signup and not email_step else ("simplified-signin" if not email_step else ""))
)
modal = f'''
{modal}'''
page_class = f"home-page auth-surface auth-{mode}"
return layout(f"{title} – Medium", content, page_class=page_class)
def recovery_page() -> str:
"""Three-step local-only password reset surface.
A correct code is available only through the session-owned fixture inbox
while the offline-harbor LOCAL_ONLY profile is active. The UI deliberately
states that no external message was delivered.
"""
body = '''
Upload a local image and alternative text. Files never leave this clone.
{media_rows or '
No inline media yet.
'}
Version history{revision_rows}'''
body = body.replace(
'',
f'{add_content}',
1,
)
return layout(f"{story.get('title') or 'New story'} – Medium", body, account=account, editor=True)
def public_story(story: Mapping[str, Any], engagement: Mapping[str, Any], *, account: Mapping[str, Any] | None = None, owner: bool = False) -> str:
topic_rows = "".join(f'{e(topic)}' for topic in story.get("topics", []))
highlight_rows = "".join(
f'
{e(row["quote"])}
'
for row in engagement.get("highlights", [])
)
responses: list[Mapping[str, Any]] = list(engagement.get("responses", []))
roots = [row for row in responses if not row.get("parent_id")]
response_html = ""
for row in roots:
children = [child for child in responses if child.get("parent_id") == row.get("response_id")]
child_html = "".join(f'{e(site_data.display_name(str(child["actor_subject_id"])))}
{e(child["body"])}
' for child in children)
response_html += f'''{e(site_data.display_name(str(row['actor_subject_id'])))}
{e(row['body'])}
{child_html}'''
state_note = "" if story["status"] == "published" else notice(f"This story is {story['status']}. Only its owner can see this recovery view.", "warning")
body = f'''{state_note}