${_('Create an account linked with {}').format(external_auth_provider)}
% else:
${_('Create an account')}
% endif
${h.link_to(_("Go to the login page to sign in with an existing account."), request.route_path('login'))}
${h.form(request.route_path('register'), needs_csrf_token=False)}
${h.text('username', defaults.get('username'))}
%if 'username' in errors:
${errors.get('username')}
%endif
% if external_auth_provider:
## store internal marker about external identity
${h.hidden('external_identity', external_auth_provider)}
## hide password prompts for social auth
% endif
${h.password('password', defaults.get('password'))}
%if 'password' in errors:
${errors.get('password')}
%endif
${h.password('password_confirmation', defaults.get('password_confirmation'))}
%if 'password_confirmation' in errors:
${errors.get('password_confirmation')}
%endif
% if external_auth_provider:
## hide password prompts for social auth
% endif
${h.text('firstname', defaults.get('firstname'))}
%if 'firstname' in errors:
${errors.get('firstname')}
%endif
${h.text('lastname', defaults.get('lastname'))}
%if 'lastname' in errors:
${errors.get('lastname')}
%endif
${h.text('email', defaults.get('email'))}
%if 'email' in errors:
${errors.get('email')}
%endif
%if captcha_active:
${h.hidden('recaptcha_field')}
%if 'recaptcha_field' in errors:
${errors.get('recaptcha_field')}
%endif