Added importer and ability to register accounts

This commit is contained in:
Yusur 2023-01-05 11:46:54 +01:00
parent 506fefc1f0
commit 83e2c892b3
9 changed files with 204 additions and 78 deletions

View file

@ -44,7 +44,8 @@
<li><a href="/accounts/login/" title="{{ T('login') }}" rel="nofollow"><span class="material-icons">login</span></a></li>
</ul>
<div class="footer">
<div class="footer-copyright">&copy; 20202022 Sakuragasaki46.</div>
<div class="footer-copyright">&copy; 20202023 Sakuragasaki46.</div>
<div class="footer-loggedinas">{% if current_user %}{{ T('logged-in-as') }}: <strong>{{ current_user.username }}</strong>{% else %}{{ T('not-logged-in') }}{% endif %}</div>
<div class="footer-actions" id="page-actions">{% block actions %}{% endblock %}</div>
<div class="footer-versions">{{app_name}} version {{app_version}}</div>
</div>

View file

@ -5,5 +5,27 @@
{% block content %}
<h1>Import pages</h1>
{% if current_user.is_admin %}
<p>
You can import files produced by the <a href="/manage/export">exporter tool</a>, in JSON format.
Importing pages can be done by users with Admin permissions only.
</p>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<div>
<input type="file" accept="application/json" name="import" />
</div>
<div>
<input type="checkbox" name="ovwurls" value="1" checked="" />
<label for="ovwurls">Overwrite URLs</label>
</div>
<div>
<input type="submit" value="Import" />
</div>
</form>
{% else %}
<p>Importing pages can be done by users with Admin permissions only.</p>
{% endif %}
{% endblock %}

View file

@ -29,5 +29,5 @@
</div>
</form>
<p>{{ T('no-account-sign-up') }} <a href="/accounts/signup" rel="nofollow">{{ T("sign-up") }}</a></p>
<p>{{ T('no-account-sign-up') }} <a href="/accounts/register" rel="nofollow">{{ T("sign-up") }}</a></p>
{% endblock %}

36
templates/register.html Normal file
View file

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block title %}{{ T('sign-up') }} {{ app_name }}{% endblock %}
{% block content %}
<h1>{{ T('sign-up') }}</h1>
<form method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<div>
<label>{{ T('username') }}:</label>
<input type="text" name="username" />
</div>
<div>
<label>{{ T('password') }}:</label>
<input type="password" name="password" />
</div>
<div>
<label>{{ T('confirm-password') }}:</label>
<input type="password" name="confirmpassword" />
</div>
<div>
<label>{{ T('email') }} ({{ T('optional') }}):</label>
<input type="email" name="email" />
</div>
<div>
<input type="checkbox" name="legal" value="1" />
<label>{{ T('have-read-terms').format(T('terms-of-service'), T('privacy-policy')) }}</label>
</div>
<div>
<input type="submit" value="{{ T('login') }}" />
</div>
</form>
<p>{{ T('already-have-account') }} <a href="/accounts/login" rel="nofollow">{{ T("login") }}</a></p>
{% endblock %}