Answers.Body: <p>I believe you're looking for the conveniently named <a href="https://docs.craftcms.com/v3/config/config-settings.html#useemailasusername" rel="nofollow noreferrer"><code>useEmailAsUsername</code></a> config setting.</p>
  
  <p>When that is set to true, any new user that is saved with a valid email address will have that copied over to the username field as well.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-23T18:45:03.887Z
Answers.Text: Now all you need to do is mark it as the answer. :P
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-07T16:48:14.187Z
Answers.Text: This made me weep with joy. So convenient and smoothly implemented.
Answers.UserDisplayName: Ray
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-11T10:41:02.723Z
Answers.Text: This is just what I needed. It would be nice if it was documented on the User registration form page in the docs. https://docs.craftcms.com/v3/dev/examples/user-registration-form.html
Answers.UserDisplayName: Tim Print
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-10T20:38:20.867Z
Answers.Text: Added a note to that page @TimPrint.
Answers.UserDisplayName: Matt Stein
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-07-23T18:36:51.053Z
Answers.LastActivityDate: 2019-06-20T20:59:34.640Z
Answers.LastEditDate: 2019-06-20T20:59:34.640Z
Answers.UserDisplayName: Brad Bell
Body: <p>Is there a specific or preferred way to set the username for new user registrations to be their email address?</p>
  
  <p>At the moment my user signup form contains both fields:</p>
  
  <pre><code>&lt;!-- Username --&gt;
    &lt;label for="username"&gt;Username&lt;/label&gt;
      &lt;input type="text" id="username" name="username" placeholder="joesmith" {%- if account is defined %} value="{{ account.username }}"{% endif -%}/&gt;
      {% if account is defined %}
          {{ _self.errorList(account.getErrors('username')) }}
      {% endif %}
  
  &lt;!-- Email --&gt;
    &lt;label for="email" &gt;Email&lt;/label&gt;
      &lt;input type="text" id="email" name="email" {%- if account is defined %} value="{{ account.email }}"{% endif -%}/ autocapitalize=off autocorrect=off&gt;
      {% if account is defined %}
          {{ _self.errorList(account.getErrors('email')) }}
      {% endif %}
  </code></pre>
  
Tags: <users>
Title: Use email address as username
ThreadText: # Use email address as username
  
  (Asked by: username_0 on 2014-07-23)
  
  Is there a specific or preferred way to set the username for new user registrations to be their email address?
  
  At the moment my user signup form contains both fields:
  
  ```
  <!-- Username -->
    <label for="username">Username</label>
      <input type="text" id="username" name="username" placeholder="joesmith" {%- if account is defined %} value="{{ account.username }}"{% endif -%}/>
      {% if account is defined %}
          {{ _self.errorList(account.getErrors('username')) }}
      {% endif %}
  
  <!-- Email -->
    <label for="email" >Email</label>
      <input type="text" id="email" name="email" {%- if account is defined %} value="{{ account.email }}"{% endif -%}/ autocapitalize=off autocorrect=off>
      {% if account is defined %}
          {{ _self.errorList(account.getErrors('email')) }}
      {% endif %}
  
  ```
  
  **Tags:** users
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-23. Score: 18 | Accepted answer
  
  I believe you're looking for the conveniently named [`useEmailAsUsername`](https://docs.craftcms.com/v3/config/config-settings.html#useemailasusername) config setting.
  
  When that is set to true, any new user that is saved with a valid email address will have that copied over to the username field as well.
  
  > **Comments:**
  > **username_1**: Now all you need to do is mark it as the answer. :P  
  > **username_2**: This made me weep with joy. So convenient and smoothly implemented.  
  > **username_3**: This is just what I needed. It would be nice if it was documented on the User registration form page in the docs. https://docs.craftcms.com/v3/dev/examples/user-registration-form.html  
  > **username_4**: Added a note to that page @username_3.  
  
  ---
  
  