schema change; added flask-login

This commit is contained in:
Yusur 2019-10-12 19:22:10 +02:00
parent 3f867b4027
commit a646c96b86
8 changed files with 100 additions and 74 deletions

View file

@ -12,14 +12,14 @@
<div class="header">
<h1><a href="{{ url_for('homepage') }}">{{ site_name }}</a></h1>
<div class="metanav">
{% if not session.logged_in %}
{% if current_user.is_anonymous %}
<a href="{{ url_for('login') }}">log in</a>
<a href="{{ url_for('register') }}">register</a>
{% else %}
<a href="{{ url_for('user_detail', username=current_user.username) }}">{{ current_user.username }}</a>
{% set notification_count = current_user.unseen_notification_count() %}
{% if notification_count > 0 %}
<a href="{{ url_for('notifications') }}">({{ notification_count }})</a>
<a href="{{ url_for('notifications') }}">(<strong>{{ notification_count }}</strong>)</a>
{% endif %}
-
<a href="{{ url_for('public_timeline') }}">explore</a>

View file

@ -2,12 +2,19 @@
{% block body %}
<h2>Login</h2>
{% if error %}<p class=error><strong>Error:</strong> {{ error }}{% endif %}
<form action="{{ url_for('login') }}" method="POST">
<form method="POST">
<dl>
<dt>Username or email:
<dd><input type="text" name="username">
<dt>Password:
<dd><input type="password" name="password">
<dt>Remember me for:
<dd><select name="remember">
<option value="0">This session only</option>
<option value="7">A week</option>
<option value="30">A month</option>
<option value="365">A year</option>
</select></dd>
<dd><input type="submit" value="Login">
</dl>
</form>

View file

@ -8,7 +8,7 @@
-
<strong>{{ user.following()|count }}</strong> following
</p>
{% if current_user %}
{% if not current_user.is_anonymous %}
{% if user.username != current_user.username %}
{% if current_user|is_following(user) %}
<form action="{{ url_for('user_unfollow', username=user.username) }}" method="post">
@ -20,6 +20,9 @@
</form>
{% endif %}
<p><a href="/create/?preload=%2B{{ user.username }}">Mention this user in a message</a></p>
{% else %}
<!-- here should go the "edit profile" button -->
<a href="/create/">Create a status</a>
{% endif %}
{% endif %}
<ul>