{% extends "base.html" %}

{% block content %}
    <div class="block"><h1 class="title is-large">{{ _("Secure Portal") }}.</h1></div>

<div class="block grid">
{% import "bulma_wtf.html" as wtf %}
    <form action="" method="post" enctype="multipart/form-data" novalidate >
        {{ form.hidden_tag() }}

            {% if raspap_installed %}
        <div class="field">
            {{ wtf.form_input_field(form.ssid, form.ssid.errors) }}
            <p class="help"> {{ _("This is the name of the advertised Wi-Fi network. Current SSID:")}} {{ get_setting('ssid') }}</p>
        </div>
        <div class="field password">
            {{ wtf.form_input_field(form.wifi_password,  form.wifi_password.errors) }}
            <p class="help"> {{ _("This is the secret key needed to connect to the Wi-Fi network. By default, this is not set
                    and everyone can join.
                    Current password:")}} {{ get_setting('wifi_password') or _('Not set')  }}</p>
        </div>
        <div class="field checkbox">
            {{ wtf.form_bool_field(form.enable_access_point) }}
            <p class="butter-form-margin help">{{ _("Whether this box will advertise a Wi-Fi network.")}}</p>
        </div>
        <div class="field checkbox">
            {{ wtf.form_bool_field(form.enable_wifi_sharing) }}
            <p class="butter-form-margin help">{{ _("Whether a share button for the Wi-Fi network is available.")}}</p>
        </div>
    {% else %}
                <div class="block"><p class="subtitle"> {{ _("Access point is only enabled when using a Raspberry Pi.") }} </p></div>
	<div style="display: none">
        <div class="field">
            {{ wtf.form_input_field(form.ssid, form.ssid.errors) }}
            <p class="help"> This is the name of the advertised Wi-Fi network. Current SSID: {{ get_setting('ssid') }}</p>
        </div>
        <div class="field password">
            {{ wtf.form_input_field(form.wifi_password,  form.wifi_password.errors) }}
            <p class="help"> This is the secret key needed to connect to the Wi-Fi network. By default, this is not set and everyone can join.
                Current password: {{ get_setting('wifi_password') or 'Not set'  }}</p>
        </div>
        <div class="field checkbox">
            {{ wtf.form_bool_field(form.enable_access_point) }}
            <p class="butter-form-margin help">Whether this box will advertise a Wi-Fi network.</p>
        </div>
        <div class="field checkbox">
            {{ wtf.form_bool_field(form.enable_wifi_sharing) }}
            <p class="butter-form-margin help">Whether a share button for the Wi-Fi network is available.</p>
        </div>
	</div>
    {% endif %}
                <div class="control block">
            <button class="button"> <a href={{ url_for("step2") }}>{{ _("Back") }}</a></button>
             {{ form.submit( class="button is-link") }}
        </div>
    </form>
</div>

{% endblock %}