I have a registration form that looks like this:
<form method="post" accept-charset="UTF-8">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="users/saveUser">
<input type="hidden" name="redirect" value="">
{% macro errorList(errors) %}
{% if errors %}
<ul class="errors">
{% for error in errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
{% from _self import errorList %}
<div class="top-row">
<div class="field-wrap">
<label for="firstName">First Name<span class="req">*</span></label>
<input type="text" id="firstName" name="fields[firstName]" required {%- if account is defined %} value="{{ account.firstName }}"{% endif %}">
{{ account is defined and account ? errorList(account.getErrors('firstName')) }}
</div>
<div class="field-wrap">
<label for="lastName">Last Name<span class="req">*</span></label>
<input type="text" id="lastName" name="fields[lastName]" required {%- if account is defined %} value="{{ account.lastName }}"{% endif %}">
{{ account is defined and account ? errorList(account.getErrors('lastName')) }}
</div>
</div>
<div class="top-row">
<div class="field-wrap">
<label for="email">Email<span class="req">*</span></label>
<input id="email" type="text" name="email" {%- if account is defined %} value="{{ account.email }}"{% endif %}>
{% if account is defined %} {{ errorList(account.getErrors('email')) }}{% endif %}
</div>
<div class="field-wrap">
<label for="company">Company<span class="req">*</span></label>
<input type="text" id="company" name="fields[company]" required {%- if account is defined %} value="{{ account.company }}"{% endif %}">
{{ account is defined and account ? errorList(account.getErrors('company')) }}
</div>
</div>
<div class="top-row">
<div class="field-wrap">
<label for="country">Country<span class="req">*</span></label>
<input type="text" id="country" name="fields[country]" required {%- if account is defined %} value="{{ account.country }}"{% endif %}">
{{ account is defined and account ? errorList(account.getErrors('country')) }}
</div>
<div class="field-wrap">
<label for="applicationArea">Application area</label>
<input type="text" id="applicationArea" name="fields[applicationArea]" {%- if account is defined %} value="{{ account.applicationArea }}"{% endif %}">
{{ account is defined and account ? errorList(account.getErrors('applicationArea')) }}
</div>
</div>
<h3><label for="username">Username</label></h3>
<input id="username" type="text" name="username"
{%- if account is defined %} value="{{ account.username }}"{% endif -%}>
{% if account is defined %}
{{ errorList(account.getErrors('username')) }}
{% endif %}
<h3><label for="password">Password</label></h3>
<input id="password" type="password" name="password">
{% if account is defined %}
{{ errorList(account.getErrors('password')) }}
{% endif %}
<div class="form-footer">
<input class="button button-block" type="submit" value="Send request">
<p class="back-to-login"><a href="#login" class="switcher"><svg width="10" height="10" role="img"><use class="closebtn__use" xlink:href="/assets/img/svg_sprite/svg_sprite.svg#arrow-pointer-right"></use></svg>Go back to login</a></p>
</div>
</form>
I made the custom fields firstName, lastName, company, applicationArea and assigned them as user profile fields.
Problem is that I don't want the user to enter a password and username on registration but send them an activation mail later. If I register a user in the form above it is added to the user list and everything works fine.
If i however remove to following part (since I don't want the username and password to the registration form):
<h3><label for="username">Username</label></h3>
<input id="username" type="text" name="username"
{%- if account is defined %} value="{{ account.username }}"{% endif -%}>
{% if account is defined %}
{{ errorList(account.getErrors('username')) }}
{% endif %}
<h3><label for="password">Password</label></h3>
<input id="password" type="password" name="password">
{% if account is defined %}
{{ errorList(account.getErrors('password')) }}
{% endif %}
This last snippet comes from the standard Craft demo registration form.
Any suggestions how to make te registration form work without the username and password?
Thans in advance!
Ps: I use Craft CMS 2.6.2958