Add profile picture uploading

This commit is contained in:
Michał Gdula 2023-06-23 12:35:16 +01:00
parent 361d76f530
commit fdac4dc402
8 changed files with 73 additions and 22 deletions

View file

@ -4,12 +4,16 @@
{% block content %}
<div class="block">
<h2 style="margin-bottom: 1rem;">Profile Settings</h2>
<form action="{{ url_for('account.settings') }}" method="POST">
<form action="{{ url_for('account.settings') }}" method="POST" enctype="multipart/form-data">
<div class="profile-settings">
<div class="picture">
<img src="{{ url_for('static', filename='images/error/2.jpg') }}" alt="Profile picture">
{% if current_user.picture %}
<img src="{{ url_for('api.upload_dir', filename=current_user.picture) }}" alt="Profile picture">
{% else %}
<img src="{{ url_for('static', filename='images/pfp.png') }}" alt="Profile picture">
{% endif %}
<label for="profile-picture">Profile Picture</label>
<input type="file" name="picture" id="profile-picture">
<input type="file" name="file" id="profile-picture">
</div>
<div class="other">
{{ text(id="profile-username", name="username", value=current_user.username) }}