Comment system for Hugo
https://labertasche.tuxstash.de/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
3 years ago
|
#!/usr/bin/env python3
|
||
|
# -*- coding: utf-8 -*-
|
||
|
# /**********************************************************************************
|
||
|
# * _author : Domeniko Gentner
|
||
|
# * _mail : code@tuxstash.de
|
||
|
# * _repo : https://git.tuxstash.de/gothseidank/labertasche
|
||
|
# * _license : This project is under MIT License
|
||
|
# *********************************************************************************/
|
||
|
from . import bp_jsconnector
|
||
|
from flask import request, redirect
|
||
|
from flask_login import login_required
|
||
|
from labertasche.database import labertasche_db as db
|
||
|
from labertasche.helper import get_id_from_project_name, export_location
|
||
|
from labertasche.models import TEmail, TComments
|
||
|
from re import match
|
||
|
|
||
|
|
||
|
@bp_jsconnector.route('/mail-toggle-status/<int:id_email>')
|
||
|
@login_required
|
||
|
def api_toggle_email_reputation(id_email):
|
||
|
address = db.session.query(TEmail).filter(TEmail.id_email == id_email).first()
|
||
|
if address:
|
||
|
setattr(address, "is_allowed", (not address.is_allowed))
|
||
|
setattr(address, "is_blocked", (not address.is_blocked))
|
||
|
db.session.commit()
|
||
|
return redirect(request.referrer)
|
||
|
|
||
|
|
||
|
@bp_jsconnector.route('/mail-reset-reputation/<int:id_email>')
|
||
|
@login_required
|
||
|
def api_reset_mail_reputation(id_email):
|
||
|
db.session.query(TEmail).filter(TEmail.id_email == id_email).delete()
|
||
|
db.session.commit()
|
||
|
return redirect(request.referrer)
|
||
|
|
||
|
|