Tweak/improve admin

main
Thomas Sileo 2022-07-14 20:05:36 +02:00
parent 426669d870
commit 8dc0e1877b
4 changed files with 11 additions and 4 deletions

View File

@ -700,13 +700,13 @@ async def login(
async def login_validation( async def login_validation(
request: Request, request: Request,
password: str = Form(), password: str = Form(),
redirect: str = Form(), redirect: str | None = Form(None),
csrf_check: None = Depends(verify_csrf_token), csrf_check: None = Depends(verify_csrf_token),
) -> RedirectResponse: ) -> RedirectResponse:
if not verify_password(password): if not verify_password(password):
raise HTTPException(status_code=401) raise HTTPException(status_code=401)
resp = RedirectResponse(redirect or "/admin/inbox", status_code=302) resp = RedirectResponse(redirect or "/admin/stream", status_code=302)
resp.set_cookie("session", session_serializer.dumps({"is_logged_in": True})) # type: ignore # noqa: E501 resp.set_cookie("session", session_serializer.dumps({"is_logged_in": True})) # type: ignore # noqa: E501
return resp return resp

View File

@ -14,6 +14,12 @@
{% endmacro %} {% endmacro %}
{% if not inbox %}
<div class="box">
<p>Nothing to see yet, <a href="{{ url_for("get_lookup") }}">start following people in the lookup section</a>.</p>
</div>
{% endif %}
{% for inbox_object in inbox %} {% for inbox_object in inbox %}
{% if inbox_object.ap_type == "Announce" %} {% if inbox_object.ap_type == "Announce" %}
{{ actor_action(inbox_object, "shared") }} {{ actor_action(inbox_object, "shared") }}

View File

@ -45,7 +45,7 @@
</div> </div>
<footer class="footer"> <footer class="footer">
Powered by <a href="https://docs.microblog.pub">microblog.pub</a> <small class="microblogpub-version"><code>{{ microblogpub_version }}</code></small> and the <a href="https://activitypub.rocks/">ActivityPub</a> protocol Powered by <a href="https://docs.microblog.pub">microblog.pub</a> <small class="microblogpub-version"><code>{{ microblogpub_version }}</code></small> and the <a href="https://activitypub.rocks/">ActivityPub</a> protocol. <a href="{{ url_for("login") }}">Admin</a>.
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -45,7 +45,8 @@ And only the last 20 interactions (likes/shares/webmentions) will be displayed,
## Admin section ## Admin section
You can login to the admin section by visiting `https://yourdomain.tld/admin` and use the password set during the initial configuration. You can login to the admin section by clicking on the `Admin` link in the footer or by visiting `https://yourdomain.tld/admin`.
The password is the one set during the initial configuration.
### Lookup ### Lookup