Skip to content

feat(console): add periodic password change policy card - #14602

Merged
HarshMN2345 merged 1 commit into
mainfrom
feat-console-password-rotation
Oct 16, 2026
Merged

HarshMN2345 merged 1 commit into
mainfrom
feat-console-password-rotation

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

What does this PR do?

Adds a Periodic password change card to Auth → Policies → Passwords for the password rotation policy from #14321, which could only be set through the API so far.

  • Toggle plus a maximum age in days, weeks, months or years, saved in seconds (1 day to 10 years).
  • maxAge is left out of the PATCH while the toggle is off, so turning the policy off keeps the stored age.
  • The card is hidden when the server reports no password-rotation policy, like the breached-password and MFA cards.
  • Added to the policies settings search, with Hebrew and Japanese copy.

Test Plan

  • eslint and prettier pass on the changed files.
  • tsc --noEmit reports no errors in the changed files.

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs? — n/a, Console only

Adds a card to Auth → Policies → Passwords for the password rotation
policy: a toggle plus a maximum age in days, weeks, months or years.
`maxAge` is left out while the policy is off so the stored age is kept,
and the card is hidden when the server reports no rotation policy.
@luxor-code-review

luxor-code-review Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 1 medium

💬 Inline comments (1)

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 Non-day-divisible maxAge makes Update spuriously enabled (PasswordRotationCard.tsx:57) — PasswordRotationCard reconstructs maxAge via createTimeUnitPair, which only knows days/weeks/months/years (PasswordRotationCard.tsx:37).

The PR adds a password-rotation policy card under the project auth policies view, letting users toggle the policy and set a max age across days/weeks/months/years units, with an update mutation wired through React Query.

Files Change
PasswordRotationCard.tsx, Passwords.tsx New policy card with unit selection, validation, and insertion into the auth policies list
project-settings.ts Parses the password-rotation policy into the auth security snapshot with a null default
react-query/hooks/auth.ts Adds an updatePasswordRotationPolicy mutation hook with cache invalidation
dictionaries/he, dictionaries/ja Hebrew and Japanese translations for the new card
policies-settings-cards.ts Registers the new card in the settings search index

Reviewed commit: 675674b

@appwrite

appwrite Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

New Console

Project ID: new-console

Sites (1)
Site Status Logs Preview QR
 New Console
new-console
Ready Ready View Logs Preview URL QR Code

Tip

MCP server integration brings LLM superpowers to Claude Desktop and Cursor IDE

@ghost

ghost commented Oct 16, 2026

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Adds a password-rotation policy card to Auth → Policies → Passwords, with a configurable maximum age and an enable toggle. The policy is parsed from the project policy list, saved through the project SDK, included in policy search, and translated into Hebrew and Japanese.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 7
File Change
apps/console/src/components/pages/projects/$projectId/auth/policies/PasswordRotationCard.tsx Adds the toggle, maximum-age input and unit selector, validation, and policy update feedback.
apps/console/src/components/pages/projects/$projectId/auth/policies/Passwords.tsx Adds the rotation card when the project reports that policy.
apps/console/src/lib/i18n/dictionaries/he/auth-storage.ts Adds Hebrew strings for the rotation card.
apps/console/src/lib/i18n/dictionaries/ja/auth-storage.ts Adds Japanese strings for the rotation card.
apps/console/src/lib/project-settings.ts Adds the parsed password-rotation policy to the auth security snapshot.
apps/console/src/lib/react-query/hooks/auth.ts Adds a mutation hook for updating the rotation policy.
apps/console/src/lib/settings-search/policies-settings-cards.ts Adds the rotation card title and keywords to policy search.

Reviewed 675674b · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@HarshMN2345
HarshMN2345 merged commit ffc2834 into main Oct 16, 2026
30 of 31 checks passed

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a periodic password-rotation policy card to the Console auth settings with he/ja translations, a new update hook, and settings-search wiring.

Key findings

Comment on lines +150 to +153
<Select
value={unit}
onValueChange={(value) => setUnit(value as TimeUnit)}
disabled={mutation.isPending || !enabled}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 bug · medium

Unit switch reinterprets value instead of converting

The unit Select calls setUnit(value as TimeUnit) without converting the current number (PasswordRotationCard.tsx:152), so a typed value is silently reinterpreted in the new unit: entering 1 day and switching to years yields 1 year, and switching 3650 days to years pushes maxAgeSeconds far past MAX_MAX_AGE_SECONDS, flipping the card into its invalid state with a value the user never chose. Values that stay within bounds (1 day -> 1 year) pass validation and would be submitted as the wrong policy. The sibling SessionLengthCard has a dedicated handleUnitChange that converts, rounds, and clamps before switching.

📋 Prompt for AI Agents

In apps/console/src/components/pages/projects/$projectId/auth/policies/PasswordRotationCard.tsx around lines 150-153, replace onValueChange={(value) => setUnit(value as TimeUnit)} with a handler mirroring SessionLengthCard's handleUnitChange in src/components/pages/projects/$projectId/auth/Security.tsx: convert toSeconds(maxAge, unit), convert back with fromSeconds(currentSeconds, newUnit), round to a whole number, clamp to Math.floor(fromSeconds(MAX_MAX_AGE_SECONDS, newUnit)), then setMaxAge(clamped) and setUnit(newUnit). Without conversion, switching units silently reinterprets the typed number (1 day becomes 1 year) and can push the value outside the 1-day/10-years bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant