@frigear-nu/account

中文文档
0.6.0发布于 2026/11/13MITTypeScriptES Module构建来源已验证近 30 天下载 3389

A module for managing the account area (profile, email, password, security) in the main frigear app.

原始使用文档
文档目录8 节
  1. Features
  2. Quick Setup
  3. Configuration
  4. API routes
  5. Composable
  6. Translations
  7. Overriding parts
  8. Page headings

@frigear-nu/account

A module for the account area (profile, security, documents, API tokens pages) in the main frigear app. Migrated from nuxt-frigear-nu's app/pages/account/**.

Features

  • 👤 Update your profile details (name, avatar).
  • ✉️ Change your email address.
  • 🔒 Change your password.
  • 🔑 Manage passkeys (via @frigear-nu/auth's usePasskeys, when WebAuthn is enabled there).
  • 🧩 Overridable composable (useAccount) and opt-in profile/security pages (built with @nuxt/ui).
  • 🗂️ An account layout: a settings page inside the public site (the site header and footer stay), with a centred max-w-5xl content column. Wide screens get a left section list with the signed-in user, narrow screens a PageSectionSwitcher, both built from the account menu of @frigear-nu/menu (when installed). Plus an overview page listing the same entries, and an account.overview widget area (when @frigear-nu/widget is installed).

This module is a UI shell: it owns no tables and no mutation routes. The forms call the self-service routes of @frigear-nu/users (/api/users/me/*) and the token routes of @frigear-nu/auth.

Quick Setup

Install the module to your Nuxt application with one command:

npx nuxt module add @frigear-nu/account

This module requires @frigear-nu/users to be installed in the host app, since its forms call the self-service routes there.

Configuration

Configure the module via the account key in nuxt.config.ts:

export default defineNuxtConfig({
  modules: [
    '@nuxthub/core',
    '@frigear-nu/users',
    '@frigear-nu/menu', // optional - enables the account navigation and overview page
    '@frigear-nu/account',
  ],
  account: {
    settings: {
      pages: {
        profile: true, // or a custom path, e.g. '/me'
        security: true,
        // Only registered when `@frigear-nu/menu` is also installed.
        index: true,
      },
    },
  },
})

API routes

These routes belong to @frigear-nu/users; the account pages call them:

  • PATCH /api/users/me - updates name/avatar.
  • PUT /api/users/me/email - updates email (rejects if already taken by another user).
  • PUT /api/users/me/password - verifies currentPassword and updates to newPassword.

All three require an authenticated session and re-map the updated user into it.

Composable

const { updateProfileDetails, changeEmailAddress, changePassword, pending, error } = useAccount()

await updateProfileDetails({ name: 'Ada Lovelace' })
await changeEmailAddress({ email: '[email protected]' })
await changePassword({ currentPassword: 'old', newPassword: 'new-password', confirmNewPassword: 'new-password' })

Translations

Strings live under the account.* namespace in da/en locale files and can be overridden in your app's i18n/locales/<code>.json. See the documentation.

Overriding parts

Any Account* component can be replaced by a same-named component in your app (the module's have a lower priority). AccountIdentity is shown next to the user in the overview's summary card (by default a role badge for anyone who is not a plain user); override it to show other details, such as a member or ID badge. To replace the whole layout, define app/layouts/account.vue in your app: it wins over the module's, and the account pages still render in it. Set account.settings.layout: false to remove the layout entirely and render the pages in whatever layout the app picks.

Page headings

The layout renders no heading: every page renders its own, as the first child of its root <div class="flex flex-col gap-4">. The module's pages use AccountHeader, a PageHeading whose title is the page's title meta, else the label of the account menu item the route belongs to; the description comes from the same item, and #actions is passed through (the API tokens page puts "Create API token" there). Pages other modules add under /account render a PageHeading with the same i18n keys as their menu item.

版本与发布记录

@frigear-nu/account 共发布 26 个版本,首次发布于 2026/10/09;过去 12 个月发布了 26 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.6.0latest2026/11/133 天前
0.5.02026/11/123 天前
0.4.02026/11/123 天前
0.3.02026/11/0510 天前
0.2.62026/11/0411 天前
0.2.52026/11/0411 天前

关于 @frigear-nu/account 的常见问题

@frigear-nu/account 是什么?

A module for managing the account area (profile, email, password, security) in the main frigear app.

如何安装 @frigear-nu/account?

在项目目录运行 npm install @frigear-nu/account,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@nuxthub/core(^0.10.12)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@frigear-nu/account 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@frigear-nu/account 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@frigear-nu/account 可以商用吗?

@frigear-nu/account 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@frigear-nu/account 的下载量有多少?

根据 npm 官方下载统计,@frigear-nu/account 在 2026/10/16 – 2026/11/14 这 30 天内被下载 3,389 次,日均约 113 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@frigear-nu/account 还在维护吗?

最新版本 0.6.0 发布于 2026/11/13(3 天前);至今共发布 26 个版本,其中过去 12 个月发布了 26 个;首次发布于 2026/10/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。