scaffolding for #10262 ol registration#11052
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements scaffolding for OpenLibrary registration verification using Internet Archive's xauthn service, refactoring account authentication logic and improving code organization.
- Adds new xauthn verify/activate method for account verification
- Refactors account plugin to move Print Disability (PD) logic to the audit layer
- Consolidates login cookie management into reusable methods
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| openlibrary/plugins/upstream/account.py | Refactors login logic, removes PD helper functions, adds new verification endpoint, and consolidates cookie handling |
| openlibrary/accounts/model.py | Moves PD-related functionality to OpenLibraryAccount class, adds InternetArchiveAccount.verify method, and integrates PD processing into audit_accounts |
Comments suppressed due to low confidence (1)
514d843 to
75cd969
Compare
3b3099b to
d742659
Compare
|
Re: Copilot round-2 review — Addressed all feedback: Real bugs fixed:
False positives (no changes needed):
|
3d5dc0e to
160ceb3
Compare
|
Tested and works; should show some sort of toast message that verification succeeded and patron is logged in if the Tested subsequent activation attempts fail (as desired); token can only be used to activate + login once. |
|
Since email is sent from achive.org system, can this block of code be removed? Is it used anywhere? |
|
TL;DR Adds support for Archive.org sendmail can be updated to email link for openlibrary.org Until this happens, the existing code should still work (for now it expects IA to send archive.org link). When we switch over, it should work automatically. |
22f723d to
fd761c9
Compare
246efff to
a993d00
Compare
I think you're talking about |
|
This all seems fine to me. I fixed a merge conflict related to our recent open redirect fixes. The commit is here. Please check it out before merging. |
- Adds /account/verify?t= endpoint: validates IA xauthn token, logs user in with S3 keys, flashes success message - Refactors account plugin: moves PD logic to audit layer, DRYs login cookie handling into set_cookies() - Moves create_link_doc to accounts/model.py; removes OL-side verification email (IA/xauthn sends it now) - Adds tests for account_verify.GET, set_cookies, InternetArchiveAccount.verify Closes #10262
8c79344 to
6095dab
Compare
for more information, see https://pre-commit.ci
Replaces inline cookie-setting in account_login.login() and the OTP redeem handler with a single module-level _set_login_cookies(audit, ol_account, remember) that owns all session cookies (login token, pd, sfw, yrg_banner_pref). Also fixes the CI ruff F821 error caused by a call to _set_account_cookies which was removed when #11052 landed.
Closes #10262
Technical
Must be coordinated with https://git.archive.org/ia/petabox/-/merge_requests/5406/diffs
Stakeholders
@jimchamp