Add forum user redirect page
This commit is contained in:
parent
396a620cf4
commit
d8f33a4111
|
@ -17,10 +17,7 @@
|
||||||
|
|
||||||
from flask import *
|
from flask import *
|
||||||
from flask_login import current_user, login_required
|
from flask_login import current_user, login_required
|
||||||
from flask_wtf import FlaskForm
|
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
from wtforms import *
|
|
||||||
from wtforms.validators import *
|
|
||||||
|
|
||||||
from app.models import *
|
from app.models import *
|
||||||
from app.tasks.forumtasks import checkForumAccount
|
from app.tasks.forumtasks import checkForumAccount
|
||||||
|
@ -37,6 +34,15 @@ def list_all():
|
||||||
return render_template("users/list.html", users=users)
|
return render_template("users/list.html", users=users)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/user/forum/<username>/")
|
||||||
|
def by_forums_username(username):
|
||||||
|
user = User.query.filter_by(forums_username=username).first()
|
||||||
|
if user:
|
||||||
|
return redirect(url_for("users.profile", username=user.username))
|
||||||
|
|
||||||
|
return render_template("users/forums_no_such_user.html", username=username)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/users/<username>/")
|
@bp.route("/users/<username>/")
|
||||||
def profile(username):
|
def profile(username):
|
||||||
user = User.query.filter_by(username=username).first()
|
user = User.query.filter_by(username=username).first()
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{{ username }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<article>
|
||||||
|
<h1>
|
||||||
|
{{ username }}
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
{{ _("Unfortunately, %(username)s doesn't have an account on ContentDB yet.", username=username) }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
{% if not current_user.is_authenticated %}
|
||||||
|
<a class="btn btn-primary" href="{{ url_for('users.claim', username=username) }}">Claim Account</a>
|
||||||
|
{% endif %}
|
||||||
|
</article>
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue