---
title: "Let users edit their profile"
description: "Let a signed-in person change their display name and avatar, pick the language their emails are written in, and move their account to a new email address with a code from each address."
canonical_url: "https://nuxt-backend.dev/docs/build/auth/accounts/profile"
---
# Let users edit their profile

> Let a signed-in person change their display name and avatar, pick the language their emails are written in, and move their account to a new email address with a code from each address.

Version: nuxt-backend 0.6.x · Tab: Build · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

- [Try it live in the playground](https://nuxt-backend.dev/playground/profile)
- [API reference](https://nuxt-backend.dev/docs/reference/api/use-email-change)
- [Source](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/components/account/ProfileSettings.vue)

People want to see their own name on what they create, and their email in their own language. The module mounts `/profile` (module option `pages.profile`), guarded for signed-in people. It renders `<ProfileSettings>`: who the person is, their name and avatar, and a change of email address. With `@nuxtjs/i18n` and two locales or more, it adds their language.

Better Auth keeps the profile on the user record. The package adds the page, the language every email follows, and an email change that takes a code from each address.

```vue [app/pages/me.vue]
<script setup lang="ts">
definePageMeta({ auth: true })
</script>

<template>
  <ProfileSettings @name-saved="name => console.info(`Saved as ${name}`)" />
</template>
```

## The display name and avatar

`<ProfileSettings>` saves both. From a form of your own, call `useAccount().updateProfile`, which takes `name`, `image` and `locale`, each optional:

```vue [app/components/NameField.vue]
<script setup lang="ts">
const { user } = useAuth()
const { updateProfile, isPending } = useAccount()
const name = ref(user.value?.name ?? '')
</script>

<template>
  <form @submit.prevent="updateProfile({ name })">
    <input v-model="name" autocomplete="name">
    <button type="submit" :aria-disabled="isPending || undefined">Save name</button>
  </form>
</template>
```

`updateProfile` never changes the email address: that takes a code from each address ([below](#a-new-email-address)).

## The language

Every account has a language, `user.locale`, and every email the package sends it is written in that language. Sign-up sets it from the sign-in page's language. With `@nuxtjs/i18n`, the module stores each locale switch on the signed-in account.

With `@nuxtjs/i18n` and two locales or more, `<ProfileSettings>` shows a language picker. A pick stores the language on the account, then switches the app with `setLocale`. From your own form, `updateProfile({ locale: 'de' })` stores one. The value is a language tag (`de`, `pt-BR`), and anything else is refused. [Send email in each reader's language](https://nuxt-backend.dev/docs/build/email/templates/languages#the-recipients-language) has the order an email picks its language in.

## The emails a person gets

`/profile` has an **Email** section: the email topics the person receives and, for each kind of notification, the channels it reaches them on (in the app, by email, as push), each a checkbox. It shows once the app declares topics or re-exports the notification channels. `useEmailPreferences()` reads and changes the same choices from a page of yours ([Let people choose their emails](https://nuxt-backend.dev/docs/build/email/preferences)).

## A new email address

The person proves both mailboxes with a code: one from the current address, then one from the new one. No link is sent, so nobody who merely opens an email can move the account. `<ProfileSettings>` runs it for you. For a form of your own, `useEmailChange()` is the same flow as a step machine:

```ts
const change = useEmailChange({ onChanged: email => console.info(`Now ${email}`) })

change.newEmail.value = 'ada@new.example'
await change.start()           // emails a code to the current address → 'confirm-current'
change.otp.value = '482913'
await change.confirmCurrent()  // checks it, emails a code to the new address → 'verify-new'
change.otp.value = '193557'
await change.verifyNew()       // checks it, and the account moves → 'done'
```

Like `useLoginFlow()`, it never rejects. A failed step stays where it was, with the reason in `error` and a rate limit's wait in `retryAfter`. `isPending` is `true` while a step's call runs.

- **Limits.** Each account can make five email-change requests an hour (`emailChange`), and every code check counts against the address the code went to (`emailOtpAttempt`, ten an hour).
- **Nobody learns who has an account.** A new address that already belongs to an account receives no code, and the flow reports nothing different.
- **Your gate is asked.** Before a code goes to the new address, and again before the account moves, the server asks your [`canSignIn`](https://nuxt-backend.dev/docs/build/auth/sign-in/hooks#gate-who-signs-in) with `purpose: 'email-change'`. `confirmCurrent()` reports a refusal in `error`.
- **Undeliverable addresses are refused** at the same step, before any code exists.
- **An administrator's visit** can change neither the address nor the language.
- **Passkeys follow.** A new name or address reaches the passkeys on this device through `signalCurrentUserDetails`, so the browser's prompt shows the new one ([Keep the browser's passkey list in step](https://nuxt-backend.dev/docs/build/auth/sign-in#keep-the-browsers-passkey-list-in-step)).

## Its props, events and slots

`<ProfileSettings>` takes `validateEmail`, `showIdentity` (`true`) and `labels`. It emits `name-saved(name)`, `email-changed(email)` and `error(message)`. Its slots `identity`, `name`, `email`, `language` and `footer` each receive the name state with `saveName`, the `emailChange` flow, and the language state. Its words are the `profile` label group ([Change copy and labels](https://nuxt-backend.dev/docs/build/ui/customize/labels)).

## Related

- [Manage passkeys and sessions](https://nuxt-backend.dev/docs/build/auth/accounts/security): the other page a person manages their account on.
- [Send email in each reader's language](https://nuxt-backend.dev/docs/build/email/templates/languages#the-recipients-language): how an email picks its language.
- [Hook into sign-in and sign-up](https://nuxt-backend.dev/docs/build/auth/sign-in/hooks#gate-who-signs-in): the gate a new address passes.
- [Account components](https://nuxt-backend.dev/docs/reference/components/account#profilesettings): `<ProfileSettings>` in full.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
