示例#1
0
文件: account.py 项目: Gwill/zerqu
def request_delete_topic(tid):
    if not current_user:
        return abort(404)
    topic = Topic.query.get_or_404(int(tid))
    if topic.user_id != current_user.id:
        return abort(403)

    # csrf token
    form = Form()
    show_message = False
    if form.validate_on_submit():
        show_message = True
        send_delete_topic_email(current_user.email, topic)
    return render_template(
        'account/request-delete-topic.html',
        topic=topic,
        form=form,
        show_message=show_message,
    )
示例#2
0
def request_delete_topic(tid):
    if not current_user:
        return abort(404)
    topic = Topic.query.get_or_404(int(tid))
    if topic.user_id != current_user.id:
        return abort(403)

    # csrf token
    form = Form()
    show_message = False
    if form.validate_on_submit():
        show_message = True
        send_delete_topic_email(current_user.email, topic)
    return render_template(
        'account/request-delete-topic.html',
        topic=topic,
        form=form,
        show_message=show_message,
    )
示例#3
0
文件: account.py 项目: Gwill/zerqu
def delete_topic(token):
    key = 'account:delete-topic:%s' % token
    tid = redis.get(key)
    if not tid:
        abort(404)

    topic = Topic.query.get_or_404(int(tid))
    title = topic.title
    form = Form()
    show_message = False
    if form.validate_on_submit():
        with db.auto_commit():
            db.session.delete(topic)
        show_message = True
    return render_template(
        'account/delete-topic.html',
        title=title,
        form=form,
        show_message=show_message,
    )
示例#4
0
def delete_topic(token):
    key = 'account:delete-topic:%s' % token
    tid = redis.get(key)
    if not tid:
        abort(404)

    topic = Topic.query.get_or_404(int(tid))
    title = topic.title
    form = Form()
    show_message = False
    if form.validate_on_submit():
        with db.auto_commit():
            db.session.delete(topic)
        show_message = True
    return render_template(
        'account/delete-topic.html',
        title=title,
        form=form,
        show_message=show_message,
    )