> ## Documentation Index
> Fetch the complete documentation index at: https://docs-dev-docs-event-stream-action-templates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Learn how to add a username field for login to database connections.

# Adding Username for Database Connections

For database connections, you can have your users sign in with a username instead of their email address.

## Require username

1. Go to [Auth0 Dashboard > Authentication > Database](https://manage.auth0.com/#/connections/database), and select the name of the connection you want to edit.
2. Locate **Requires Username**, and use the toggle to enable or disable requiring a username.

   <Frame>
     <img src="https://mintcdn.com/docs-dev-docs-event-stream-action-templates/0yESejeOU6QiEi-j/docs/images/cdy7uua7fh8z/1MlOrFmcSCOCRYKRxWz6xT/7a87dac16a31cbb6e608489c5843d6c7/2025-02-25_12-02-23.png?fit=max&auto=format&n=0yESejeOU6QiEi-j&q=85&s=b1e8d7069b66140e26bd226d67ad591b" alt="Enable or disable require username setting" width="899" height="569" data-path="docs/images/cdy7uua7fh8z/1MlOrFmcSCOCRYKRxWz6xT/7a87dac16a31cbb6e608489c5843d6c7/2025-02-25_12-02-23.png" />
   </Frame>

To see how this will affect the login screen, select the **Try Connection** view. Notice that once **Requires Username** is enabled, new users must enter a username and their email address to sign up.

<Frame>
  <img src="https://mintcdn.com/docs-dev-docs-event-stream-action-templates/RjB12i6aOVmBONJv/docs/images/cdy7uua7fh8z/AiB37UZqyBPb8h55PZtzm/73e6fd0033f63f865c40f189db1620ef/2025-01-29_15-22-11.png?fit=max&auto=format&n=RjB12i6aOVmBONJv&q=85&s=b075667b0f6acae218c68587101c06bd" alt="Login form with username" width="398" height="677" data-path="docs/images/cdy7uua7fh8z/AiB37UZqyBPb8h55PZtzm/73e6fd0033f63f865c40f189db1620ef/2025-01-29_15-22-11.png" />
</Frame>

Users can then login with either their username or their email address. Users who registered while **Requires Username** was disabled will not have a Username field stored and will have to log in with their email address.

### Username length

The default allowed length for usernames is between 1 and 15 characters. However, using the <Tooltip tip="Auth0 Dashboard: Auth0's main product to configure your services." cta="View Glossary" href="/docs/glossary?term=Auth0+Dashboard">Auth0 Dashboard</Tooltip> or via the <Tooltip tip="Management API: A product to allow customers to perform administrative tasks." cta="View Glossary" href="/docs/glossary?term=Management+API">Management API</Tooltip> v2, you can modify the length minimum and maximum (up to a maximum length of 128 characters).

### Allowed characters

The username field accepts the following characters:

* Alphanumeric characters (without accent marks, automatically converted to lowercase);
* The at sign (@) character (but email addresses are not allowed);
* The caret (^) character;
* The dollar sign (\$) character;
* The dot (.) character;
* The exclamation (!) character;
* The grave accent (\`) character;
* The minus (-) character;
* The number sign (#) character;
* The plus (+) character;
* The single quote (') character;
* The tilde (\~) character;
* The underscore (\_) character;

No other characters/symbols are allowed, and Auth0 does not validate or sanitize custom database inputs.
