Added input form constraints

master
Ionut Filip 6 years ago
parent b9ecc0ccc6
commit b3c7c45140

@ -20,7 +20,7 @@ services:
env_file: {{ env }} env_file: {{ env }}
env: env:
- TLS_FLAVOR={{ tls_flavor }} - TLS_FLAVOR={{ tls_flavor }}
- ADMIN={{ admin_enabled or 'no' }} - ADMIN={{ admin_enabled or 'false' }}
ports: ports:
{% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %} {% for port in (80, 443, 25, 465, 587, 110, 995, 143, 993) %}
{% if bind4 %} {% if bind4 %}
@ -112,7 +112,7 @@ services:
{% endif %} {% endif %}
# Webmail # Webmail
{% if webmail_enabled %} {% if webmail_type != 'none' %}
webmail: webmail:
image: mailu/{{ webmail_type }}:{{ version }} image: mailu/{{ webmail_type }}:{{ version }}
restart: always restart: always

@ -33,8 +33,9 @@ POSTMASTER={{ postmaster or 'admin'}}
HOSTNAMES={{ hostnames }} HOSTNAMES={{ hostnames }}
# Authentication rate limit (per source IP address) # Authentication rate limit (per source IP address)
AUTH_RATELIMIT={% if auth_ratelimit_pm %}{{ auth_ratelimit_pm }}/minute;{% endif %} {% if auth_ratelimit_pm > '0' and auth_ratelimit_ph > '0' %}
{% if auth_ratelimit_ph %}{{ auth_ratelimit_ph }}/hour{% endif %} AUTH_RATELIMIT={{ auth_ratelimit_pm }}/minute;{{ auth_ratelimit_ph }}/hour
{% endif %}
# Opt-out of statistics, replace with "True" to opt out # Opt-out of statistics, replace with "True" to opt out
DISABLE_STATISTICS={{ disable_statistics or 'False' }} DISABLE_STATISTICS={{ disable_statistics or 'False' }}
@ -47,7 +48,6 @@ DISABLE_STATISTICS={{ disable_statistics or 'False' }}
#ADMIN={{ admin_enabled or 'false' }} #ADMIN={{ admin_enabled or 'false' }}
#Chose which webmail to run if any #Chose which webmail to run if any
#WEBMAIL_ENABLED={{ webmail_enabled or 'false' }}
#WEBMAIL={{ webmail_type or 'none' }} #WEBMAIL={{ webmail_type or 'none' }}
#Antivirus solution #Antivirus solution

@ -3,12 +3,15 @@
<div class="form-group"> <div class="form-group">
<label>Root path: </label> <label>Root path: </label>
<input class="form-control" type="text" name="root" value="/mailu"> <!-- Validates path -->
<input class="form-control" type="text" name="root" value="/mailu" required pattern="^/[-_A-Za-z0-9]+(/[-_A-Za-z0-9]*)*">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Main mail domain</label> <label>Main mail domain</label>
<input class="form-control" type="text" name="domain" placeholder="e.g. mailu.io"> <!-- Validates domain name -->
<input class="form-control" type="text" name="domain" placeholder="e.g. mailu.io"
required pattern="^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$">
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
@ -20,7 +23,7 @@
<div class="form-group"> <div class="form-group">
<label>Postmaster local part (will append the main mail domain)</label> <label>Postmaster local part (will append the main mail domain)</label>
<input class="form-control" type="text" name="postmaster" value="admin"> <input class="form-control" type="text" name="postmaster" value="admin" required>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -35,8 +38,11 @@
<div class="form-group"> <div class="form-group">
<label>Authentication rate limit (per source IP address)</label> <label>Authentication rate limit (per source IP address)</label>
<p><input class="form-control" style="width: 7%; display: inline;" type="text" name="auth_ratelimit_pm">/minute; <!-- Validates number input only -->
<input class="form-control" style="width: 7%; display: inline;;" type="text" name="auth_ratelimit_ph">/hour</p> <p><input class="form-control" style="width: 7%; display: inline;" type="number" name="auth_ratelimit_pm"
value="10" required >/minute;
<input class="form-control" style="width: 7%; display: inline;;" type="number" name="auth_ratelimit_ph"
value="1000" required >/hour</p>
</div> </div>
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
@ -48,12 +54,14 @@
<div class="form-group"> <div class="form-group">
<label>Website name</label> <label>Website name</label>
<input class="form-control" type="text" name="site_name" value="Mailu"> <input class="form-control" type="text" name="site_name" value="Mailu" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label>Linked Website URL</label> <label>Linked Website URL</label>
<input class="form-control" type="text" name="website" value="https://mailu.io"> <!-- Validates url with or without https:// -->
<input class="form-control" type="url" name="website" value="https://mailu.io" required
pattern="^(https?://)?([a-zA-Z0-9]([a-zA-ZäöüÄÖÜ0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$">
</div> </div>
{% endcall %} {% endcall %}

@ -14,12 +14,16 @@ avoid generic all-interfaces addresses like <code>0.0.0.0</code> or <code>::</co
<div class="form-group"> <div class="form-group">
<label>IPv4 listen address</label> <label>IPv4 listen address</label>
<input class="form-control" type="text" name="bind4" placeholder="1.2.3.4"> <!-- Validates IPv4 address -->
<input class="form-control" type="text" name="bind4" value="127.0.0.1" required
pattern="^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$">
</div> </div>
<div class="form-group"> <div class="form-group">
<label>IPv6 listen address</label> <label>IPv6 listen address</label>
<input class="form-control" type="text" name="bind6" placeholder="2001:be4:1234::1"> <!-- Validates IPv6 address -->
<input class="form-control" type="text" name="bind6" value="::1"
pattern="/^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})\z/i">
</div> </div>
<p>You server will be available under a main hostname but may expose multiple public <p>You server will be available under a main hostname but may expose multiple public
@ -28,6 +32,8 @@ hostnames in its <code>MX</code> record. Hostnames must be coma-separated.</p>
<div class="form-group"> <div class="form-group">
<label>Public hostnames</label> <label>Public hostnames</label>
<input class="form-control" type="text" name="hostnames" placeholder="my.host.name,other.host.name" multiple> <!-- Validates hostname or list of hostnames -->
<input class="form-control" type="text" name="hostnames" placeholder="my.host.name,other.host.name" multiple required
pattern="^(?:(?:\w+(?:-+\w+)*\.)+[a-z]+)*(?:,(?:(?:\w+(?:-+\w+)*\.)+[a-z]+)\s*)*$">
</div> </div>
{% endcall %} {% endcall %}

@ -18,16 +18,23 @@ manage your email domains, users, etc.</p>
email client. These do add some complexity but provide an easier way of email client. These do add some complexity but provide an easier way of
accessing messages for beginner users.</p> accessing messages for beginner users.</p>
<!-- Switched from radio buttons to dropdown menu in order to remove the checkbox -->
<div class="form-group"> <div class="form-group">
<label>Enable Web email client (and path to the Web email client)</label> <label>Enable Web email client (and path to the Web email client)</label>
<div class="input-group"> <!-- <div class="radio"> -->
<div class="input-group-addon"><input type="checkbox" name="webmail_enabled" value="true"></div> <!-- {{ macros.radio("webmail_type", "roundcube", "RoundCube", "popular Webmail running on top of PHP") }} -->
<input class="form-control" type="text" name="webmail_path" value="/webmail"> <!-- {{ macros.radio("webmail_type", "rainloop", "Rainloop", "lightweight Webmail based on PHP, no database") }} -->
</div> <!-- </div> -->
<br/>
<select name="webmail_type">
{% for webmailtype in ["none", "roundcube", "rainloop"] %}
<option value="{{ webmailtype }}" >{{ webmailtype }}</option>
{% endfor %}
</select>
<p></p> <p></p>
<div class="radio"> <div class="input-group">
{{ macros.radio("webmail_type", "roundcube", "RoundCube", "popular Webmail running on top of PHP") }} <!-- <div class="input-group-addon"><input type="checkbox" name="webmail_enabled" value="true"></div> -->
{{ macros.radio("webmail_type", "rainloop", "Rainloop", "lightweight Webmail based on PHP, no database") }} <input class="form-control" type="text" name="webmail_path" value="/webmail">
</div> </div>
</div> </div>

@ -9,11 +9,11 @@
{% endcall %} {% endcall %}
<form method="post" action="{{ url_for(".submit") }}"> <form method="post" action="{{ url_for(".submit") }}">
{% include "steps/initial-config.html" %} {% include "steps/compose/flavor.html" %}
{% include "steps/flavor.html" %} {% include "steps/compose/config.html" %}
{% include "steps/expose.html" %} {% include "steps/compose/services.html" %}
{% include "steps/services.html" %} {% include "steps/compose/expose.html" %}
<!-- {% include "steps/optional.html" %} --> <!-- {% include "steps/compose/optional.html" %} -->
<input class="btn btn-primary" type="submit" value="Setup Mailu"> <input class="btn btn-primary" type="submit" value="Setup Mailu">
</form> </form>

Loading…
Cancel
Save