首页 文章 精选 留言 我的

精选列表

搜索[前端],共10000篇文章
优秀的个人博客,低调大师

在前端项目中定期清理 localStorage:一个容易被忽视的过期策略

做后台系统时经常把一些不敏感的状态塞进 localStorage,比如展开的菜单、表格列宽、临时筛选条件。时间一长,这些键值越积越多,用户换了设备或者需求变更后,旧数据反而成了脏数据来源。更麻烦的是,有些缓存其实带有时间语义,比如接口返回的城市列表,超过一天就应该失效重新拉取,但 localStorage 本身没有过期机制。手动在每次读取时写 `if (Date.now() - savedAt > TTL)` 会散落在各处,维护起来很烦。这篇文章从实际场景出发,先讲清 localStorage 无过期的本质,然后给出一个带 TTL 的封装方案,再讨论什么时候该主动清理、如何避免清理时误删其他模块的数据,以及跨标签页场景下的一些细节。最后附上可直接复用的工具函数和迁移旧数据的思路。 ## localStorage 本身没有过期概念 localStorage 的 API 只有 `setItem`、`getItem`、`removeItem`、`clear` 和 `key`。数据写入后一直存在,除非用户手动清除浏览器数据、代码显式删除,或者触发存储配额淘汰(大多数浏览器在磁盘压力下才会做)。它不会因为你设置的某个时间点自动消失。 这跟 sessionStorage 不同,后者在标签页关闭后清空,适合单次会话。而 localStorage 是跨会话的,所以更需要你自己来管理生命周期。 一个常见的错误做法是把过期时间直接拼在值里: ```js localStorage.setItem('cityList', JSON.stringify({ data: list, expire: Date.now() + 24 * 60 * 60 * 1000 })); ``` 这样写没问题,但每个用到的地方都要手动判断 `expire`,而且如果存的是字符串、数字这类原始值,包装和解包会破坏原有类型,调用方得知道内部结构。更好的方式是把过期逻辑收敛到一个工具层。 ## 封装一个带 TTL 的存储工具 目标很简单:`set` 时可选传入存活时间,`get` 时如果已过期就自动删除并返回 `null`。同时要能区分“不存在”和“存在但值为 null”的情况,所以内部用一个包装对象,存 `{ v: value, e: expireTimestamp }`。 ```ts interface StorageItem { v: T; e: number | null; // null 表示永不过期 } function setItem(key: string, value: T, ttlMs?: number): void { const item: StorageItem = { v: value, e: ttlMs ? Date.now() + ttlMs : null }; try { localStorage.setItem(key, JSON.stringify(item)); } catch (err) { // 配额超限,考虑清理或降级 console.warn('localStorage 写入失败', err); } } function getItem(key: string): T | null { const raw = localStorage.getItem(key); if (raw === null) return null; let item: StorageItem; try { item = JSON.parse(raw); } catch { // 旧数据不是我们的格式,直接清掉 localStorage.removeItem(key); return null; } if (item.e !== null && Date.now() > item.e) { localStorage.removeItem(key); return null; } return item.v; } ``` 这样使用方只需要: ```ts setItem('cityList', list, 24 * 60 * 60 * 1000); const cached = getItem('cityList'); if (!cached) { // 重新请求 } ``` 类型参数让调用方拿到正确的类型,不用再 `as` 来 `as` 去。 ### 兼容已有裸数据 项目里已经存了很多不带包装的键,直接切到新格式会导致读取失败。迁移时可以在 `getItem` 里加一层判断:如果解析出来的对象没有 `v` 字段,说明是旧数据,按原样返回并可选地重写为新格式。 ```ts function getItem(key: string): T | null { const raw = localStorage.getItem(key); if (raw === null) return null; let parsed: any; try { parsed = JSON.parse(raw); } catch { return raw as unknown as T; // 存的就是纯字符串 } if (parsed && typeof parsed === 'object' && 'v' in parsed) { // 新格式 if (parsed.e !== null && Date.now() > parsed.e) { localStorage.removeItem(key); return null; } return parsed.v; } // 旧格式,原样返回,不做清理 return parsed as T; } ``` 这段代码看起来有点杂,但迁移期很实用。等旧键自然被覆盖或手动清掉后,可以简化回纯包装格式。 ## 主动清理的时机 即使每个键都有 TTL,惰性删除只在读取时触发。如果某个键存了之后再也没人读,它会一直占着空间。下面几个时机适合做主动扫描。 应用启动时。在根组件挂载前,跑一次全量扫描,把所有已过期的键删掉。代价是遍历一遍 localStorage,通常几十到几百个键,开销可忽略。 ```ts function cleanExpired(): void { const now = Date.now(); const keysToRemove: string[] = []; for (let i = 0; i item.e) { keysToRemove.push(key); } } catch { // 不是 JSON,跳过 } } keysToRemove.forEach(k => localStorage.removeItem(k)); } ``` 写入配额超限时。`setItem` 抛 `QuotaExceededError` 时,可以先清一次过期项再重试。 ```ts function safeSetItem(key: string, value: unknown, ttlMs?: number) { try { localStorage.setItem(key, JSON.stringify({ v: value, e: ttlMs ? Date.now() + ttlMs : null })); } catch (err) { if (err instanceof DOMException && err.name === 'QuotaExceededError') { cleanExpired(); // 再试一次 localStorage.setItem(key, JSON.stringify({ v: value, e: ttlMs ? Date.now() + ttlMs : null })); } else { throw err; } } } ``` 注意 `cleanExpired` 之后再写入仍可能失败,因为过期数据可能不够释放空间,这时只能向上报错或降级到内存存储。 ## 别用 clear 清整个 localStorage 有些项目为了“清理缓存”直接调 `localStorage.clear()`。这会把其他库、其他模块甚至同域下其他页面的数据一并删掉。比如第三方 SDK 的 token、用户手动保存的草稿、另一个标签页正在用的状态。 清理应该只针对自己管理的键。可以给所有键加统一前缀,比如 `app:`,扫描时只处理这个前缀下的条目。 ```ts const PREFIX = 'app:'; function scopedKey(key: string) { return PREFIX + key; } function cleanExpired() { const now = Date.now(); const keys: string[] = []; for (let i = 0; i { const raw = localStorage.getItem(k); if (!raw) return; try { const item = JSON.parse(raw); if (item?.e && now > item.e) localStorage.removeItem(k); } catch {} }); } ``` 前缀也方便排查问题,在 DevTools 里过滤一下就能看到自己的数据。 ## storage 事件与跨标签页同步 浏览器会在同源的其他标签页修改 localStorage 时触发 `storage` 事件。可以利用它来同步清理或更新状态,但注意这个事件只在其他标签页触发,当前页自己改不会收到。 如果两个标签页共用一个带 TTL 的键,一个标签页删了它,另一个标签页的缓存应该失效。可以监听事件,把本地内存里的副本也清掉。 ```ts window.addEventListener('storage', (e) => { if (e.key === 'app:cityList' && e.newValue === null) { // 其他标签页删除了这个键,本地内存缓存也要失效 memoryCache.delete('cityList'); } }); ``` 但没必要在 `storage` 事件里做全量清理,因为事件只针对单个键,做全量扫描反而浪费。 ## 什么时候不该用 localStorage 带 TTL 的封装解决的是“不敏感、可丢失、有明确过期时间”的数据。如果数据涉及身份凭证、支付信息,localStorage 不是好选择,因为它可以被任意同源脚本读取,XSS 一旦发生就直接泄露。这类数据应该放在 httpOnly cookie 或服务端会话里。 另外,如果数据量很大(比如几 MB 的表格缓存),localStorage 的同步读写会阻塞主线程,这时 IndexedDB 更合适。localStorage 适合小体积、低频读写的配置类数据。 我现在的做法是:所有进入 localStorage 的键都必须经过封装层,且强制要求显式传 TTL 或明确传 `null` 表示永久。代码审查时看到裸的 `localStorage.setItem` 就要求改掉。这样至少能保证过期逻辑不会散落在业务代码里,清理也有统一的入口。 推荐查看天气:http://www.362tq.com/liangzihu/40tian.html 推荐查看天气:http://www.362tq.com/echeng/ 推荐查看天气:http://www.362tq.com/echeng/zuotian.html 推荐查看天气:http://www.362tq.com/echeng/7tian.html 推荐查看天气:http://www.362tq.com/echeng/10tian.html 推荐查看天气:http://www.362tq.com/echeng/15tian.html 推荐查看天气:http://www.362tq.com/echeng/40tian.html 推荐查看天气:http://www.362tq.com/jingmen/ 推荐查看天气:http://www.362tq.com/jingmen/zuotian.html 推荐查看天气:http://www.362tq.com/jingmen/7tian.html 推荐查看天气:http://www.362tq.com/jingmen/10tian.html 推荐查看天气:http://www.362tq.com/jingmen/15tian.html 推荐查看天气:http://www.362tq.com/jingmen/40tian.html 推荐查看天气:http://www.362tq.com/dongbao/ 推荐查看天气:http://www.362tq.com/dongbao/zuotian.html 推荐查看天气:http://www.362tq.com/dongbao/7tian.html 推荐查看天气:http://www.362tq.com/dongbao/10tian.html 推荐查看天气:http://www.362tq.com/dongbao/15tian.html 推荐查看天气:http://www.362tq.com/dongbao/40tian.html 推荐查看天气:http://www.362tq.com/duodao/ 推荐查看天气:http://www.362tq.com/duodao/zuotian.html 推荐查看天气:http://www.362tq.com/duodao/7tian.html 推荐查看天气:http://www.362tq.com/duodao/10tian.html 推荐查看天气:http://www.362tq.com/duodao/15tian.html 推荐查看天气:http://www.362tq.com/duodao/40tian.html 推荐查看天气:http://www.362tq.com/jingshan/ 推荐查看天气:http://www.362tq.com/jingshan/zuotian.html 推荐查看天气:http://www.362tq.com/jingshan/7tian.html 推荐查看天气:http://www.362tq.com/jingshan/10tian.html 推荐查看天气:http://www.362tq.com/jingshan/15tian.html 推荐查看天气:http://www.362tq.com/jingshan/40tian.html 推荐查看天气:http://www.362tq.com/shayang/ 推荐查看天气:http://www.362tq.com/shayang/zuotian.html 推荐查看天气:http://www.362tq.com/shayang/7tian.html 推荐查看天气:http://www.362tq.com/shayang/10tian.html 推荐查看天气:http://www.362tq.com/shayang/15tian.html 推荐查看天气:http://www.362tq.com/shayang/40tian.html 推荐查看天气:http://www.362tq.com/zhongxiang/ 推荐查看天气:http://www.362tq.com/zhongxiang/zuotian.html 推荐查看天气:http://www.362tq.com/zhongxiang/7tian.html 推荐查看天气:http://www.362tq.com/zhongxiang/10tian.html 推荐查看天气:http://www.362tq.com/zhongxiang/15tian.html 推荐查看天气:http://www.362tq.com/zhongxiang/40tian.html 推荐查看天气:http://www.362tq.com/xiaogan/ 推荐查看天气:http://www.362tq.com/xiaogan/zuotian.html 推荐查看天气:http://www.362tq.com/xiaogan/7tian.html 推荐查看天气:http://www.362tq.com/xiaogan/10tian.html 推荐查看天气:http://www.362tq.com/xiaogan/15tian.html 推荐查看天气:http://www.362tq.com/xiaogan/40tian.html 推荐查看天气:http://www.362tq.com/xiaonan/ 推荐查看天气:http://www.362tq.com/xiaonan/zuotian.html 推荐查看天气:http://www.362tq.com/xiaonan/7tian.html 推荐查看天气:http://www.362tq.com/xiaonan/10tian.html 推荐查看天气:http://www.362tq.com/xiaonan/15tian.html 推荐查看天气:http://www.362tq.com/xiaonan/40tian.html 推荐查看天气:http://www.362tq.com/xiaochang/ 推荐查看天气:http://www.362tq.com/xiaochang/zuotian.html 推荐查看天气:http://www.362tq.com/xiaochang/7tian.html 推荐查看天气:http://www.362tq.com/xiaochang/10tian.html 推荐查看天气:http://www.362tq.com/xiaochang/15tian.html 推荐查看天气:http://www.362tq.com/xiaochang/40tian.html 推荐查看天气:http://www.362tq.com/dawu/ 推荐查看天气:http://www.362tq.com/dawu/zuotian.html 推荐查看天气:http://www.362tq.com/dawu/7tian.html 推荐查看天气:http://www.362tq.com/dawu/10tian.html 推荐查看天气:http://www.362tq.com/dawu/15tian.html 推荐查看天气:http://www.362tq.com/dawu/40tian.html 推荐查看天气:http://www.362tq.com/yunmeng/ 推荐查看天气:http://www.362tq.com/yunmeng/zuotian.html 推荐查看天气:http://www.362tq.com/yunmeng/7tian.html 推荐查看天气:http://www.362tq.com/yunmeng/10tian.html 推荐查看天气:http://www.362tq.com/yunmeng/15tian.html 推荐查看天气:http://www.362tq.com/yunmeng/40tian.html 推荐查看天气:http://www.362tq.com/anlu/ 推荐查看天气:http://www.362tq.com/anlu/zuotian.html 推荐查看天气:http://www.362tq.com/anlu/7tian.html 推荐查看天气:http://www.362tq.com/anlu/10tian.html 推荐查看天气:http://www.362tq.com/anlu/15tian.html 推荐查看天气:http://www.362tq.com/anlu/40tian.html 推荐查看天气:http://www.362tq.com/hanchuan/ 推荐查看天气:http://www.362tq.com/hanchuan/zuotian.html 推荐查看天气:http://www.362tq.com/hanchuan/7tian.html 推荐查看天气:http://www.362tq.com/hanchuan/10tian.html 推荐查看天气:http://www.362tq.com/hanchuan/15tian.html 推荐查看天气:http://www.362tq.com/hanchuan/40tian.html 推荐查看天气:http://www.362tq.com/jingzhou/ 推荐查看天气:http://www.362tq.com/jingzhou/zuotian.html 推荐查看天气:http://www.362tq.com/jingzhou/7tian.html 推荐查看天气:http://www.362tq.com/jingzhou/10tian.html 推荐查看天气:http://www.362tq.com/jingzhou/15tian.html 推荐查看天气:http://www.362tq.com/jingzhou/40tian.html 推荐查看天气:http://www.362tq.com/shashi/ 推荐查看天气:http://www.362tq.com/shashi/zuotian.html 推荐查看天气:http://www.362tq.com/shashi/7tian.html 推荐查看天气:http://www.362tq.com/shashi/10tian.html 推荐查看天气:http://www.362tq.com/shashi/15tian.html 推荐查看天气:http://www.362tq.com/shashi/40tian.html 推荐查看天气:http://www.362tq.com/gongan/ 推荐查看天气:http://www.362tq.com/gongan/zuotian.html 推荐查看天气:http://www.362tq.com/gongan/7tian.html 推荐查看天气:http://www.362tq.com/gongan/10tian.html 推荐查看天气:http://www.362tq.com/gongan/15tian.html 推荐查看天气:http://www.362tq.com/gongan/40tian.html 推荐查看天气:http://www.362tq.com/jianli/ 推荐查看天气:http://www.362tq.com/jianli/zuotian.html 推荐查看天气:http://www.362tq.com/jianli/7tian.html 推荐查看天气:http://www.362tq.com/jianli/10tian.html 推荐查看天气:http://www.362tq.com/jianli/15tian.html 推荐查看天气:http://www.362tq.com/jianli/40tian.html 推荐查看天气:http://www.362tq.com/jiangling/ 推荐查看天气:http://www.362tq.com/jiangling/zuotian.html 推荐查看天气:http://www.362tq.com/jiangling/7tian.html 推荐查看天气:http://www.362tq.com/jiangling/10tian.html 推荐查看天气:http://www.362tq.com/jiangling/15tian.html 推荐查看天气:http://www.362tq.com/jiangling/40tian.html 推荐查看天气:http://www.362tq.com/shishou/ 推荐查看天气:http://www.362tq.com/shishou/zuotian.html 推荐查看天气:http://www.362tq.com/shishou/7tian.html 推荐查看天气:http://www.362tq.com/shishou/10tian.html 推荐查看天气:http://www.362tq.com/shishou/15tian.html 推荐查看天气:http://www.362tq.com/shishou/40tian.html 推荐查看天气:http://www.362tq.com/honghu/ 推荐查看天气:http://www.362tq.com/honghu/zuotian.html 推荐查看天气:http://www.362tq.com/honghu/7tian.html 推荐查看天气:http://www.362tq.com/honghu/10tian.html 推荐查看天气:http://www.362tq.com/honghu/15tian.html 推荐查看天气:http://www.362tq.com/honghu/40tian.html 推荐查看天气:http://www.362tq.com/songzi/ 推荐查看天气:http://www.362tq.com/songzi/zuotian.html 推荐查看天气:http://www.362tq.com/songzi/7tian.html 推荐查看天气:http://www.362tq.com/songzi/10tian.html 推荐查看天气:http://www.362tq.com/songzi/15tian.html 推荐查看天气:http://www.362tq.com/songzi/40tian.html 推荐查看天气:http://www.362tq.com/huanggang/ 推荐查看天气:http://www.362tq.com/huanggang/zuotian.html 推荐查看天气:http://www.362tq.com/huanggang/7tian.html 推荐查看天气:http://www.362tq.com/huanggang/10tian.html 推荐查看天气:http://www.362tq.com/huanggang/15tian.html 推荐查看天气:http://www.362tq.com/huanggang/40tian.html 推荐查看天气:http://www.362tq.com/huangzhou/ 推荐查看天气:http://www.362tq.com/huangzhou/zuotian.html 推荐查看天气:http://www.362tq.com/huangzhou/7tian.html 推荐查看天气:http://www.362tq.com/huangzhou/10tian.html 推荐查看天气:http://www.362tq.com/huangzhou/15tian.html 推荐查看天气:http://www.362tq.com/huangzhou/40tian.html 推荐查看天气:http://www.362tq.com/tuanfeng/ 推荐查看天气:http://www.362tq.com/tuanfeng/zuotian.html 推荐查看天气:http://www.362tq.com/tuanfeng/7tian.html 推荐查看天气:http://www.362tq.com/tuanfeng/10tian.html 推荐查看天气:http://www.362tq.com/tuanfeng/15tian.html 推荐查看天气:http://www.362tq.com/tuanfeng/40tian.html 推荐查看天气:http://www.362tq.com/hongan/ 推荐查看天气:http://www.362tq.com/hongan/zuotian.html 推荐查看天气:http://www.362tq.com/hongan/7tian.html 推荐查看天气:http://www.362tq.com/hongan/10tian.html 推荐查看天气:http://www.362tq.com/hongan/15tian.html 推荐查看天气:http://www.362tq.com/hongan/40tian.html 推荐查看天气:http://www.362tq.com/luotian/ 推荐查看天气:http://www.362tq.com/luotian/zuotian.html 推荐查看天气:http://www.362tq.com/luotian/7tian.html 推荐查看天气:http://www.362tq.com/luotian/10tian.html 推荐查看天气:http://www.362tq.com/luotian/15tian.html 推荐查看天气:http://www.362tq.com/luotian/40tian.html 推荐查看天气:http://www.362tq.com/huanggangyingshan/ 推荐查看天气:http://www.362tq.com/huanggangyingshan/zuotian.html 推荐查看天气:http://www.362tq.com/huanggangyingshan/7tian.html 推荐查看天气:http://www.362tq.com/huanggangyingshan/10tian.html 推荐查看天气:http://www.362tq.com/huanggangyingshan/15tian.html 推荐查看天气:http://www.362tq.com/huanggangyingshan/40tian.html 推荐查看天气:http://www.362tq.com/huanggangxishui/ 推荐查看天气:http://www.362tq.com/huanggangxishui/zuotian.html 推荐查看天气:http://www.362tq.com/huanggangxishui/7tian.html 推荐查看天气:http://www.362tq.com/huanggangxishui/10tian.html 推荐查看天气:http://www.362tq.com/huanggangxishui/15tian.html 推荐查看天气:http://www.362tq.com/huanggangxishui/40tian.html 推荐查看天气:http://www.362tq.com/qinchun/ 推荐查看天气:http://www.362tq.com/qinchun/zuotian.html 推荐查看天气:http://www.362tq.com/qinchun/7tian.html 推荐查看天气:http://www.362tq.com/qinchun/10tian.html 推荐查看天气:http://www.362tq.com/qinchun/15tian.html 推荐查看天气:http://www.362tq.com/qinchun/40tian.html 推荐查看天气:http://www.362tq.com/huangmei/ 推荐查看天气:http://www.362tq.com/huangmei/zuotian.html 推荐查看天气:http://www.362tq.com/huangmei/7tian.html 推荐查看天气:http://www.362tq.com/huangmei/10tian.html 推荐查看天气:http://www.362tq.com/huangmei/15tian.html 推荐查看天气:http://www.362tq.com/huangmei/40tian.html 推荐查看天气:http://www.362tq.com/wuxue/ 推荐查看天气:http://www.362tq.com/wuxue/zuotian.html 推荐查看天气:http://www.362tq.com/wuxue/7tian.html 推荐查看天气:http://www.362tq.com/wuxue/10tian.html 推荐查看天气:http://www.362tq.com/wuxue/15tian.html 推荐查看天气:http://www.362tq.com/wuxue/40tian.html 推荐查看天气:http://www.362tq.com/xianning/ 推荐查看天气:http://www.362tq.com/xianning/zuotian.html 推荐查看天气:http://www.362tq.com/xianning/7tian.html 推荐查看天气:http://www.362tq.com/xianning/10tian.html 推荐查看天气:http://www.362tq.com/xianning/15tian.html 推荐查看天气:http://www.362tq.com/xianning/40tian.html 推荐查看天气:http://www.362tq.com/xianan/

优秀的个人博客,低调大师

Vercel 发布面向 Web 前端开发的 AI 大模型「v0-1.0-md」

Vercel 发布了名为「v0-1.0-md」的 AI 大模型。 据介绍,「v0-1.0-md」专为构建现代 Web 应用程序而设计,该多模态模型支持文本和图像输入,提供 128000 个词元的上下文窗口和 32000 个词元的输出限制,定价为每百万输入词元 3 美元,每百万输出词元15 美元。 它提供诸如“自动修复”常见编码错误和“快速编辑”等功能,可在代码生成时实时流式传输内联更改。至关重要的是,v0-1.0-md 使用与 OpenAI 兼容的 API,这意味着您可以将其插入现有工具(例如 Cursor、Codex)或自定义应用程序(只要这些应用程序已经支持 OpenAI 语言规范),包括 Vercel 自己的AI SDK。 import { generateText } from 'ai'; import { createOpenAI } from '@ai-sdk/openai'; const vercel = createOpenAI({ baseURL: 'https://api.v0.dev/v1', apiKey: process.env.VERCEL_V0_API_KEY, }); const { text } = await generateText({ model: vercel('v0-1.0-md'), prompt: 'Create a Next.js AI chatbot with authentication', }); 它还支持函数和工具调用,并提供低延迟流式响应。开发人员可以在 Vercel AI Playground 中试用这个新模型,了解它如何处理不同的提示。 更多细节查看官方文档。

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码