mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-10 04:08:34 -06:00
Create proper edit profile form w/ CSRF & refactor User.about_me null/empty string handling
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<img src="{{ url_for('static', filename='default_photo.png') }}"
|
||||
alt="{{ user.username }}'s Profile Picture">
|
||||
</div>
|
||||
<p class="user-box-minibio">{{ user.about_me }}</p>
|
||||
<p class="user-box-minibio">{{ user.display_about() }}</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<div class="profile-bio">
|
||||
<p>
|
||||
<strong>About me:</strong><br>
|
||||
{{ user.about_me or "This user hasn't written a bio yet." }}
|
||||
{{ user.display_about() }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
{% extends 'layouts/index.html' %}
|
||||
{% from 'macros.html' import render_field %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Edit Profile</h3>
|
||||
<form method="POST" action="{{ url_for('forms.edit_profile_post', username=user.username) }}" class="form">
|
||||
<label>
|
||||
Name<br>
|
||||
<input type="text" name="name" value="{{ user.name }}">
|
||||
</label><br>
|
||||
<label>
|
||||
About Me
|
||||
<textarea type="text" name="about-me">{{ user.about_me }}</textarea>
|
||||
</label>
|
||||
<button class="button">Save & Submit</button>
|
||||
<form method="POST" class="form">
|
||||
{{ form.csrf_token }}
|
||||
{{ render_field(form.name) }}
|
||||
{{ render_field(form.about_me) }}
|
||||
<input type="submit" value="Save & Submit">
|
||||
</form>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<span class="error-message">
|
||||
{{ messages[0] }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user