Skip to content

spring: Add Flask password-sync utility (1/4 split of #168) - #169

Open
RudraBJoshi wants to merge 2 commits into
Open-Coding-Society:masterfrom
CSA-Admin-OCS:split/spring/s1-flask-password-sync
Open

spring: Add Flask password-sync utility (1/4 split of #168)#169
RudraBJoshi wants to merge 2 commits into
Open-Coding-Society:masterfrom
CSA-Admin-OCS:split/spring/s1-flask-password-sync

Conversation

@RudraBJoshi

Copy link
Copy Markdown

Splitting #168 into smaller, independently-reviewable PRs across spring/flask/pages. This one covers password database syncing.

Adds FlaskPasswordSync, a standalone utility that calls Flask's POST /api/internal/sync-password with a shared secret, so a Spring-side reset can keep Flask's password in sync. Not wired up to any caller yet — that happens in the next PR in this stack, which depends on this class existing.

Stack: this PR → "Add OAuth + student ID verified password reset flow" and "Refuse to sync a plaintext password to Flask..." both branch from here.

Original PR: #168

FlaskPasswordSync calls Flask's internal sync endpoint
(POST /api/internal/sync-password) with a shared secret
(INTERNAL_SYNC_KEY), so a password reset completed on Spring also lands
on the Flask account for the same uid. Not wired up to any caller yet --
that's the OAuth-verified reset flow, next PR in the stack. Best-effort:
a sync failure is logged, not fatal to whatever already-successful
operation triggered it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Ensures any Claude Code session working in this repo automatically sees
that .clauderc (one directory up, at the prodsys root) has the project
structure, ongoing work, deploy requirements, and known gaps -- CLAUDE.md
is auto-loaded into context at session start, .clauderc on its own is not.
@jm1021

jm1021 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

This should be tied to Profile Password reset

@jm1021

jm1021 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

The process from the logged-in Reset Password should use this utility.

IF Login -> Profile/Reset Password button -> Delete all Cookies -> Reset Flask -> Reset Spring (if the Spring account does not exist, create it) -> Force Logout -> Return to the login page.

IF Logout -> we need to put them through an identification process, probably by sending them an email. On the email confirmation link, you can reset their Flask password to a temporary password. The next login should force them to reset their password. I don't believe we want to do more than reset Flask as we may have several needs for recovery and we should have that sequence in one place.

RudraBJoshi added a commit to CSA-Admin-OCS/spring that referenced this pull request Aug 31, 2026
Addresses jm1021's review feedback on PR Open-Coding-Society#169/flask Open-Coding-Society#74 ("tied to
Profile Password reset") reinterpreted for the current architecture:
the profile page's direct password field was removed in a later PR in
the same stack in favor of routing everyone through this OAuth wizard,
so "tied to profile reset" now means "tied to the wizard's completion".

Track MVC logins in a SessionRegistry (tracking only, no session cap)
and force-expire a uid's sessions after /reset/oauth/complete succeeds,
closing the previously-documented gap where the JWT path invalidated on
password change but the MVC HttpSession path didn't.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@RudraBJoshi

Copy link
Copy Markdown
Author

Addressed in split/spring/s2-oauth-verified-reset (spring #170): reinterpreted for the current architecture since the profile page's own direct password-change field was removed in a later PR (pages #1371) in favor of routing everyone -- logged in or not -- through the same OAuth-verified reset wizard. /reset/oauth/complete now force-expires the account's MVC sessions via a new SessionRegistry-backed invalidateActiveSessions, and the frontend explicitly calls Spring's /logout on success to clear that browser's cookies too, closing the gap where a password reset invalidated JWTs but not the session-based admin-portal login. The 'reset Flask first, create Spring if missing' direction doesn't map onto the current design -- the OAuth flow requires a uid's Spring account to already exist just to authenticate the request, so there's no path where that could trigger. Full writeup in spring/docs/forgot-password-pipeline.md under 'MVC HttpSession invalidation.'

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.

2 participants