aboutsummaryrefslogtreecommitdiff
path: root/srcs/phpmyadmin/templates/preferences
diff options
context:
space:
mode:
Diffstat (limited to 'srcs/phpmyadmin/templates/preferences')
-rw-r--r--srcs/phpmyadmin/templates/preferences/autoload.twig15
-rw-r--r--srcs/phpmyadmin/templates/preferences/forms/main.twig8
-rw-r--r--srcs/phpmyadmin/templates/preferences/manage/error.twig20
-rw-r--r--srcs/phpmyadmin/templates/preferences/manage/main.twig112
-rw-r--r--srcs/phpmyadmin/templates/preferences/two_factor/configure.twig11
-rw-r--r--srcs/phpmyadmin/templates/preferences/two_factor/confirm.twig12
-rw-r--r--srcs/phpmyadmin/templates/preferences/two_factor/main.twig60
7 files changed, 238 insertions, 0 deletions
diff --git a/srcs/phpmyadmin/templates/preferences/autoload.twig b/srcs/phpmyadmin/templates/preferences/autoload.twig
new file mode 100644
index 0000000..4c61045
--- /dev/null
+++ b/srcs/phpmyadmin/templates/preferences/autoload.twig
@@ -0,0 +1,15 @@
+<div id="prefs_autoload" class="notice print_ignore hide">
+ <form action="prefs_manage.php" method="post" class="disableAjax">
+ {{ hidden_inputs|raw }}
+ <input type="hidden" name="json" value="">
+ <input type="hidden" name="submit_import" value="1">
+ <input type="hidden" name="return_url" value="{{ return_url }}">
+ {% trans %}
+ Your browser has phpMyAdmin configuration for this domain. Would you like to import it for current session?
+ {% endtrans %}
+ <br>
+ <a href="#yes">{% trans "Yes" %}</a>
+ / <a href="#no">{% trans "No" %}</a>
+ / <a href="#delete">{% trans "Delete settings" %}</a>
+ </form>
+</div>
diff --git a/srcs/phpmyadmin/templates/preferences/forms/main.twig b/srcs/phpmyadmin/templates/preferences/forms/main.twig
new file mode 100644
index 0000000..563b385
--- /dev/null
+++ b/srcs/phpmyadmin/templates/preferences/forms/main.twig
@@ -0,0 +1,8 @@
+{{ error|raw }}
+{% if has_errors %}
+ <div class="error config-form">
+ <strong>{% trans 'Cannot save settings, submitted form contains errors!' %}</strong>
+ {{ errors|raw }}
+ </div>
+{% endif %}
+{{ form|raw }}
diff --git a/srcs/phpmyadmin/templates/preferences/manage/error.twig b/srcs/phpmyadmin/templates/preferences/manage/error.twig
new file mode 100644
index 0000000..d6b3522
--- /dev/null
+++ b/srcs/phpmyadmin/templates/preferences/manage/error.twig
@@ -0,0 +1,20 @@
+{{ 'Configuration contains incorrect data for some fields.'|trans|error }}
+<div class="config-form">
+ {{ form_errors|raw }}
+</div>
+<form action="prefs_manage.php" method="post" class="disableAjax">
+ {{ get_hidden_inputs() }}
+ <input type="hidden" name="json" value="{{ json }}">
+ <input type="hidden" name="fix_errors" value="1">
+ {% if import_merge is not empty %}
+ <input type="hidden" name="import_merge" value="1">
+ {% endif %}
+ {% if return_url %}
+ <input type="hidden" name="return_url" value="{{ return_url }}">
+ {% endif %}
+ <p>
+ {% trans 'Do you want to import remaining settings?' %}
+ </p>
+ <input class="btn btn-secondary" type="submit" name="submit_import" value="{{ 'Yes'|trans }}">
+ <input class="btn btn-secondary" type="submit" name="submit_ignore" value="{{ 'No'|trans }}">
+</form>
diff --git a/srcs/phpmyadmin/templates/preferences/manage/main.twig b/srcs/phpmyadmin/templates/preferences/manage/main.twig
new file mode 100644
index 0000000..0e51327
--- /dev/null
+++ b/srcs/phpmyadmin/templates/preferences/manage/main.twig
@@ -0,0 +1,112 @@
+{{ error|raw }}
+<script type="text/javascript">
+ {{ get_js_value("Messages.strSavedOn", 'Saved on: @DATE@'|trans) }}
+</script>
+<div id="maincontainer">
+ <div id="main_pane_left">
+ <div class="group">
+ <h2> {% trans 'Import' %} </h2>
+ <form class="group-cnt prefs-form disableAjax" name="prefs_import" action="prefs_manage.php" method="post"
+ enctype="multipart/form-data">
+ {{ generate_hidden_max_file_size(max_upload_size) }}
+ {{ get_hidden_inputs() }}
+ <input type="hidden" name="json" value="">
+ <input type="radio" id="import_text_file" name="import_type" value="text_file" checked="checked">
+ <label for="import_text_file"> {% trans 'Import from file' %} </label>
+ <div id="opts_import_text_file" class="prefsmanage_opts">
+ <label for="input_import_file"> {% trans 'Browse your computer:' %} </label>
+ <input type="file" name="import_file" id="input_import_file">
+ </div>
+ <input type="radio" id="import_local_storage" name="import_type" value="local_storage"
+ disabled="disabled">
+ <label for="import_local_storage"> {% trans 'Import from browser\'s storage' %} </label>
+ <div id="opts_import_local_storage" class="prefsmanage_opts disabled">
+ <div class="localStorage-supported">
+ {% trans 'Settings will be imported from your browser\'s local storage.' %}
+ <br>
+ <div class="localStorage-exists">
+ {% trans 'Saved on: @DATE@' %}
+ </div>
+ <div class="localStorage-empty">
+ {{ 'You have no saved settings!'|trans|notice }}
+ </div>
+ </div>
+ <div class="localStorage-unsupported">
+ {{ 'This feature is not supported by your web browser'|trans|notice }}
+ </div>
+ </div>
+ <input type="checkbox" id="import_merge" name="import_merge">
+ <label for="import_merge"> {% trans 'Merge with current configuration' %} </label>
+ <br><br>
+ <input class="btn btn-primary" type="submit" name="submit_import" value="{{ 'Go'|trans }}">
+ </form>
+ </div>
+ {% if exists_setup_and_not_exists_config %}
+ {# show only if setup script is available, allows to disable this message #}
+ {# by simply removing setup directory #}
+ {# Also do not show in config exists (and setup would refuse to work) #}
+ <div class="group">
+ <h2>{% trans 'More settings' %}</h2>
+ <div class="group-cnt">
+ {{ 'You can set more settings by modifying config.inc.php, eg. by using %sSetup script%s.'|trans|format('<a href="setup/index.php" target="_blank">','</a>')|raw }}
+ {{ show_docu('setup', 'setup-script') }}
+ </div>
+ </div>
+ {% endif %}
+ </div>
+ <div id="main_pane_right">
+ <div class="group">
+ <h2>{% trans 'Export' %}</h2>
+ <div class="click-hide-message group-cnt hide">
+ {{ 'Configuration has been saved.'|trans|raw_success }}
+ </div>
+ <form class="group-cnt prefs-form disableAjax" name="prefs_export"
+ action="prefs_manage.php" method="post">
+ {{ get_hidden_inputs() }}
+ <div>
+ <input type="radio" id="export_text_file" name="export_type"
+ value="text_file" checked="checked">
+ <label for="export_text_file">
+ {% trans 'Save as JSON file' %}
+ </label><br>
+ <input type="radio" id="export_php_file" name="export_type" value="php_file">
+ <label for="export_php_file">
+ {% trans 'Save as PHP file' %}
+ </label><br>
+ <input type="radio" id="export_local_storage" name="export_type" value="local_storage"
+ disabled="disabled">
+ <label for="export_local_storage">
+ {% trans 'Save to browser\'s storage' %}
+ </label>
+ </div>
+ <div id="opts_export_local_storage"
+ class="prefsmanage_opts disabled">
+ <span class="localStorage-supported">
+ {% trans 'Settings will be saved in your browser\'s local storage.' %}
+ <div class="localStorage-exists">
+ <b>
+ {% trans 'Existing settings will be overwritten!' %}
+ </b>
+ </div>
+ </span>
+ <div class="localStorage-unsupported">
+ {{ 'This feature is not supported by your web browser'|trans|notice }}
+ </div>
+ </div>
+ <br>
+ <input class="btn btn-primary" type="submit" name="submit_export" value="{% trans 'Go' %}">
+ </form>
+ </div>
+ <div class="group">
+ <h2>{% trans 'Reset' %}</h2>
+ <form class="group-cnt prefs-form disableAjax" name="prefs_reset"
+ action="prefs_manage.php" method="post">
+ {{ get_hidden_inputs() }}
+ {% trans 'You can reset all your settings and restore them to default values.' %}
+ <br><br>
+ <input class="btn btn-secondary" type="submit" name="submit_clear" value="{% trans 'Reset' %}">
+ </form>
+ </div>
+ </div>
+ <br class="clearfloat">
+</div>
diff --git a/srcs/phpmyadmin/templates/preferences/two_factor/configure.twig b/srcs/phpmyadmin/templates/preferences/two_factor/configure.twig
new file mode 100644
index 0000000..574f112
--- /dev/null
+++ b/srcs/phpmyadmin/templates/preferences/two_factor/configure.twig
@@ -0,0 +1,11 @@
+<div class="group">
+<h2>{% trans "Configure two-factor authentication" %}</h2>
+<div class="group-cnt">
+<form method="POST" action="prefs_twofactor.php">
+{{ get_hidden_inputs() }}
+<input type="hidden" name="2fa_configure" value="{{ configure }}">
+{{ form|raw }}
+<input class="btn btn-secondary" type="submit" value="{% trans "Enable two-factor authentication" %}">
+</form>
+</div>
+</div>
diff --git a/srcs/phpmyadmin/templates/preferences/two_factor/confirm.twig b/srcs/phpmyadmin/templates/preferences/two_factor/confirm.twig
new file mode 100644
index 0000000..f1ef175
--- /dev/null
+++ b/srcs/phpmyadmin/templates/preferences/two_factor/confirm.twig
@@ -0,0 +1,12 @@
+<div class="group">
+<h2>{% trans "Confirm disabling two-factor authentication" %}</h2>
+<div class="group-cnt">
+<form method="POST" action="prefs_twofactor.php">
+{{ "By disabling two factor authentication you will be again able to login using password only."|trans|notice }}
+{{ get_hidden_inputs() }}
+{{ form|raw }}
+<input type="hidden" name="2fa_remove" value="1">
+<input class="btn btn-secondary" type="submit" value="{% trans "Disable two-factor authentication" %}">
+</form>
+</div>
+</div>
diff --git a/srcs/phpmyadmin/templates/preferences/two_factor/main.twig b/srcs/phpmyadmin/templates/preferences/two_factor/main.twig
new file mode 100644
index 0000000..f95c047
--- /dev/null
+++ b/srcs/phpmyadmin/templates/preferences/two_factor/main.twig
@@ -0,0 +1,60 @@
+<div class="group">
+ <h2>
+ {% trans "Two-factor authentication status" %}
+ {{ show_docu('two_factor') }}
+ </h2>
+ <div class="group-cnt">
+ {% if enabled %}
+ {% if num_backends == 0 %}
+ <p>{% trans "Two-factor authentication is not available, please install optional dependencies to enable authentication backends." %}</p>
+ <p>{% trans "Following composer packages are missing:" %}</p>
+ <ul>
+ {% for item in missing %}
+ <li><code>{{ item.dep }}</code> ({{ item.class }})</li>
+ {% endfor %}
+ </ul>
+ {% else %}
+ {% if backend_id %}
+ <p>{% trans "Two-factor authentication is available and configured for this account." %}</p>
+ {% else %}
+ <p>{% trans "Two-factor authentication is available, but not configured for this account." %}</p>
+ {% endif %}
+ {% endif %}
+ {% else %}
+ <p>{% trans "Two-factor authentication is not available, enable phpMyAdmin configuration storage to use it." %}</p>
+ {% endif %}
+ </div>
+</div>
+
+{% if backend_id %}
+ <div class="group">
+ <h2>{{ backend_name }}</h2>
+ <div class="group-cnt">
+ <p>{% trans "You have enabled two factor authentication." %}</p>
+ <p>{{ backend_description }}</p>
+ <form method="post" action="prefs_twofactor.php">
+ {{ get_hidden_inputs() }}
+ <input class="btn btn-secondary" type="submit" name="2fa_remove" value="
+ {%- trans "Disable two-factor authentication" %}">
+ </form>
+ </div>
+ </div>
+{% elseif num_backends > 0 %}
+ <div class="group">
+ <h2>{% trans "Configure two-factor authentication" %}</h2>
+ <div class="group-cnt">
+ <form method="post" action="prefs_twofactor.php">
+ {{ get_hidden_inputs() }}
+ {% for backend in backends %}
+ <label class="displayblock">
+ <input type="radio" name="2fa_configure" value="{{ backend["id"] }}"
+ {{- backend["id"] == "" ? ' checked' }}>
+ <strong>{{ backend["name"] }}</strong>
+ <p>{{ backend["description"] }}</p>
+ </label>
+ {% endfor %}
+ <input class="btn btn-secondary" type="submit" value="{% trans "Configure two-factor authentication" %}">
+ </form>
+ </div>
+ </div>
+{% endif %}