"Remember me" checkbox on login #48
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a "remember me" checkbox on the login form so that it remembers the user session on this device
Now I have the full picture. Implementing:
Now the i18n strings in all three locales:
Now the test file, following the repo's
node --testsource-check convention — with theTokenStoreitself tested functionally via stubbed browser storage:Pre-existing failure on the clean tree — unrelated to my change. Now let me run my new test file and the full suite:
All 9 of my tests pass; the only suite failure is the pre-existing one from master. Let me quickly check why that file fails differently than mine — I want to make sure my new file doesn't share the cause:
The failing file is a pre-existing problem unrelated to this issue — I'll note it in the summary and leave it untouched. Final review of my complete diff:
Done. Summary of the change for issue #48 ("Remember me" checkbox on login):
What was implemented
A login now has two lifetimes: with Remember me the session persists on the device (localStorage + 30-day token); without it the token lives only in
sessionStorage, so closing the browser ends the session (token keeps the existing 48 h cap).frontend/app/services/TokenStore.js(new) — single place that decides which browser store holds the login token:GetToken()(sessionStorage, falling back to localStorage),SetToken(token, remember)(clears both, writes one),ClearToken(). A separate leaf module so bothServer.jsandUser.jsuse it without an import cycle.frontend/app/services/User.js—SetUser(token, remember)stores via the token store;GetUser/LoadUserread throughGetToken();LogoutUserclears both stores.frontend/app/services/Server.js— the axios auth interceptor reads the token throughGetToken()instead oflocalStoragedirectly.frontend/app/components/windows/LoginWindow.vue— "Remember me on this device" checkbox (default checked, matching the app's previous always-persistent behavior) between password and the login button; its value is sent to/user/loginand passed toSetUser.backend/src/routes/user.js—POST /user/loginacceptsremember;expiresIn: remember ? 2592000 : 172800(30 days vs the existing 48 h).frontend/app/components/views/ServiceLinkAuthorize.vue— its sign-in passesremember = trueexplicitly so the service-link flow keeps the persistent session it had before.login.remember-meadded to all three locales (en/es/ca).Tests — new
tests/remember-me.test.js(9 tests):TokenStoreis exercised for real against stubbed browser storages (remember→localStorage, plain→sessionStorage, store switching replaces the token, clearing empties both), plus source checks for the checkbox wiring, token reads going through the store, the backend lifetime split, and the locale strings. All 9 pass. Full suite: 130/131 — the one failure istests/item-folder-sync.test.js, which already fails identically on the clean tree (a top-levelawaitmakes Node 20 re-parse it as ESM and itsrequires then fail); it is unrelated to this issue and was left untouched.Implementation is ready for review: #52