{%- set page_title = get_part('profile page title', word('User profile')) %}
{%- set tab_title = get_part('profile page tab title', word('User profile')) %}
{%- set extra_css = get_part('profile page extra css') %}
{%- set extra_js = get_part('profile page extra javascript') %}
{%- extends 'flask_user/public_base.html' %}
{%- block content %}
{%- from "base_templates/form_macros.html" import render_field, render_submit_field %}
          <h1>{{ get_part('profile page heading', word('User profile')) }}</h1>
          {{ get_part('profile page pre') }}
          <div class="row">
            <div class="col text-right">
              <div class="dropdown">
                <button class="btn {{ config['BUTTON_STYLE'] }}secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-cogs"></i> {{ word('Other settings') }}</button>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
              {% if current_user.social_id.startswith('local') %}<a class="dropdown-item" href="{{ url_for('user.change_password') }}">{{ word('Change password') }}</a>{% endif %}{% if config['ENABLE_PLAYGROUND'] and (current_user.email) and (not current_user.is_anonymous) and (not current_user.has_roles(['admin', 'developer'])) %}<a class="dropdown-item" href="{{ url_for('request_developer') }}">{{ word('Request Developer Account') }}</a>{% endif %}{% if config['ENABLE_PLAYGROUND'] and config['USE_GOOGLE_DRIVE'] and (not current_user.is_anonymous) and (current_user.has_roles(['admin', 'developer'])) %}<a class="dropdown-item" href="{{ url_for('google_drive_page') }}">{{ word('Google Drive synchronization') }}</a>{% endif %}{% if config['ENABLE_PLAYGROUND'] and config['USE_ONEDRIVE'] and (not current_user.is_anonymous) and (current_user.has_roles(['admin', 'developer'])) %}<a class="dropdown-item" href="{{ url_for('onedrive_page') }}">{{ word('OneDrive synchronization') }}</a>{% endif %}{% if config['USE_MFA'] and current_user.has_roles(config['MFA_ROLES']) and current_user.social_id.startswith('local') %}<a class="dropdown-item" href="{{ url_for('mfa_reconfigure') }}">{{ word('Second factor authentication') }}</a>{% endif %}{% if config['ENABLE_PLAYGROUND'] and config['USE_GITHUB'] and (not current_user.is_anonymous) and (current_user.has_roles(['admin', 'developer'])) %}<a class="dropdown-item" href="{{ url_for('github_menu') }}">{{ word('GitHub integration') }}</a>{% endif %}{% if current_user.has_roles(config['API_ROLES']) %}<a class="dropdown-item" href="{{ url_for('manage_api') }}">{{ word('API keys') }}</a>{% endif %}{% if config['ENABLE_MANAGE_ACCOUNT'] and not current_user.has_roles(['admin']) %}<a class="dropdown-item" href="{{ url_for('manage_account') }}">{{ word('Manage account') }}</a>{% endif %}
                </div>
              </div>
            </div>
          </div>
          <form action="" method="POST" role="form">
            {{ form.hidden_tag() }}
            {{ render_field(form.first_name) }}
            {{ render_field(form.last_name) }}
            {%- if current_user.social_id and current_user.social_id.startswith('phone$') %}
            {{ render_field(form.email) }}
            {%- endif %}
            {%- if (not current_user.is_anonymous) and current_user.has_roles(['admin', 'developer']) %}
            {{ render_field(form.country, right_message='<a target="_blank" href="http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">List of Country Codes</a>') }} 
            {{ render_field(form.subdivisionfirst) }}
            {{ render_field(form.subdivisionsecond) }}
            {{ render_field(form.subdivisionthird) }}
            {{ render_field(form.organization) }}
            {{ render_field(form.language) }}
            {{ render_field(form.timezone) }}
            {%- if config['ENABLE_PLAYGROUND'] and config['USE_PYPI'] %}
            {{ render_field(form.pypi_username) }}
            {{ render_field(form.pypi_password) }}
            {%- endif %}
            {%- endif %}
            <br>
            {{ get_part('profile page submit') }}<div class="form-actions">
              {{ render_submit_field(form.submit) }}
            </div>
          </form>{{ get_part('profile page post') }}
{%- endblock %}
