def login(): '''Redirects to the homepage if the user is logged in. Displays the login page if the user is not logged in.''' if (user.is_logged_in()): return redirect(url_for("home")) if 'msg' in request.args: flash('Please log in before following a politician', 'danger') return render_template("login.html")
def settings(): """Settings for users, shows list of all followed politicians and can unfollow.""" if (user.is_logged_in()): for name in request.args: database.unfollow(session['id'], name) followed = [] data = database.get_followed(session['id']) for row in data: followed.append(row[0]) return render_template("settings.html", listFollowed=followed, s=session) else: flash("You must be logged in to see that page!", "danger") return redirect(url_for("home"))
def render(self, navbar: dict): if is_logged_in(): return redirect('/profile') return super(Login, self).render(navbar=navbar)
def visible(self): return not is_logged_in()
def before_request(): if request.path.startswith('/static/'): return None elif request.path not in allow_anonymous and not is_logged_in(): return redirect('login')
def register(): '''Display the register page.''' if (user.is_logged_in()): redirect(url_for("home")) return render_template("register.html", isLoggedIn=user.is_logged_in())