2021-09-23 18:40:49 +02:00
|
|
|
from mailu import models, utils
|
2017-09-24 12:00:39 +02:00
|
|
|
from mailu.ui import ui, forms, access
|
2016-03-19 21:37:48 +02:00
|
|
|
|
2021-02-07 19:08:58 +02:00
|
|
|
from flask import current_app as app
|
2016-03-19 21:37:48 +02:00
|
|
|
import flask
|
2016-08-13 20:51:54 +02:00
|
|
|
import flask_login
|
2016-11-10 11:48:37 +02:00
|
|
|
|
2016-03-19 21:37:48 +02:00
|
|
|
|
2017-09-24 12:00:39 +02:00
|
|
|
@ui.route('/', methods=["GET"])
|
2016-08-29 19:24:39 +02:00
|
|
|
@access.authenticated
|
2016-03-19 21:37:48 +02:00
|
|
|
def index():
|
2016-03-20 16:36:56 +02:00
|
|
|
return flask.redirect(flask.url_for('.user_settings'))
|
2016-03-19 21:37:48 +02:00
|
|
|
|
2021-12-30 16:29:56 +02:00
|
|
|
@ui.route('/ui/')
|
|
|
|
def redirect_old_path():
|
|
|
|
return flask.redirect(flask.url_for('.index'), code=301)
|
|
|
|
|
2017-09-24 12:00:39 +02:00
|
|
|
@ui.route('/announcement', methods=['GET', 'POST'])
|
2016-11-10 11:48:37 +02:00
|
|
|
@access.global_admin
|
|
|
|
def announcement():
|
|
|
|
form = forms.AnnouncementForm()
|
|
|
|
if form.validate_on_submit():
|
2017-11-10 12:56:43 +02:00
|
|
|
for user in models.User.query.all():
|
|
|
|
user.sendmail(form.announcement_subject.data,
|
|
|
|
form.announcement_body.data)
|
2016-11-10 11:48:37 +02:00
|
|
|
# Force-empty the form
|
|
|
|
form.announcement_subject.data = ''
|
|
|
|
form.announcement_body.data = ''
|
|
|
|
flask.flash('Your announcement was sent', 'success')
|
2017-11-10 12:56:43 +02:00
|
|
|
return flask.render_template('announcement.html', form=form)
|
2018-04-11 21:45:17 +02:00
|
|
|
|
2021-02-06 18:23:05 +02:00
|
|
|
@ui.route('/webmail', methods=['GET'])
|
|
|
|
def webmail():
|
|
|
|
return flask.redirect(app.config['WEB_WEBMAIL'])
|
2018-04-11 21:45:17 +02:00
|
|
|
|
|
|
|
@ui.route('/client', methods=['GET'])
|
|
|
|
def client():
|
|
|
|
return flask.render_template('client.html')
|
2021-09-02 22:49:36 +02:00
|
|
|
|
2021-10-29 11:22:46 +02:00
|
|
|
@ui.route('/webui_antispam', methods=['GET'])
|
2021-09-02 22:49:36 +02:00
|
|
|
def antispam():
|
|
|
|
return flask.render_template('antispam.html')
|