1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-16 10:59:53 +02:00
Mailu/core/admin/mailu/ui/views/base.py

65 lines
1.9 KiB
Python
Raw Normal View History

from mailu import models
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
@ui.route('/', methods=["GET"])
@access.authenticated
2016-03-19 21:37:48 +02:00
def index():
return flask.redirect(flask.url_for('.user_settings'))
2016-03-19 21:37:48 +02:00
@ui.route('/login', methods=['GET', 'POST'])
2016-03-19 21:37:48 +02:00
def login():
form = forms.LoginForm()
if form.validate_on_submit():
user = models.User.login(form.email.data, form.pw.data)
if user:
flask.session.regenerate()
2016-03-19 21:37:48 +02:00
flask_login.login_user(user)
endpoint = flask.request.args.get('next', '.index')
2017-09-17 18:55:54 +02:00
return flask.redirect(flask.url_for(endpoint)
or flask.url_for('.index'))
2016-03-19 21:37:48 +02:00
else:
flask.flash('Wrong e-mail or password', 'error')
2016-03-19 21:37:48 +02:00
return flask.render_template('login.html', form=form)
@ui.route('/logout', methods=['GET'])
@access.authenticated
2016-03-19 21:37:48 +02:00
def logout():
flask_login.logout_user()
flask.session.destroy()
return flask.redirect(flask.url_for('.index'))
2016-04-24 19:17:40 +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')
AdminLTE3 optimizations & compression and caching - fixed copy of qemu-arm-static for alpine - added 'set -eu' safeguard - silenced npm update notification - added color to webpack call - changed Admin-LTE default blue (core/admin/Dockerfile) - AdminLTE 3 style tweaks (core/admin/assets/app.css) (core/admin/mailu/ui/templates/base.html) (core/admin/mailu/ui/templates/sidebar.html) - localized datatables (core/admin/Dockerfile) (core/admin/assets/app.js) (core/admin/package.json) - moved external javascript code to vendor.js (core/admin/assets/app.js) (core/admin/assets/vendor.js) (core/admin/webpack.config.js) - added mailu logo (core/admin/assets/app.js) (core/admin/assets/app.css) (core/admin/assets/mailu.png) - moved all inline javascript to app.js (core/admin/assets/app.js) (core/admin/mailu/ui/templates/domain/create.html) (core/admin/mailu/ui/templates/user/create.html) - added iframe display of rspamd page (core/admin/assets/app.js) (core/admin/mailu/ui/views/base.py) (core/admin/mailu/ui/templates/sidebar.html) (core/admin/mailu/ui/templates/antispam.html) - updated language-selector to display full language names and use post (core/admin/assets/app.js) (core/admin/mailu/__init__.py) (core/admin/mailu/utils.py) (core/admin/mailu/ui/views/languages.py) - added fieldset to group and en/disable input fields (core/admin/assets/app.js) (core/admin/mailu/ui/templates/macros.html) (core/admin/mailu/ui/templates/user/settings.html) (core/admin/mailu/ui/templates/user/reply.html) - added clipboard copy buttons (core/admin/assets/app.js) (core/admin/assets/vendor.js) (core/admin/mailu/ui/templates/macros.html) (core/admin/mailu/ui/templates/domain/details.html) - cleaned external javascript imports (core/admin/assets/vendor.js) - pre-split first hostname for further use (core/admin/mailu/__init__.py) (core/admin/mailu/models.py) (core/admin/mailu/ui/templates/client.html) (core/admin/mailu/ui/templates/domain/signup.html) - cache dns_* properties of domain object (immutable during runtime) (core/admin/mailu/models.py) (core/admin/mailu/ui/templates/domain/details.html) - fixed and splitted dns_dkim property of domain object (space missing) - added autoconfig and tlsa properties to domain object (core/admin/mailu/models.py) - suppressed extra vertical spacing in jinja2 templates - improved accessibility for screen reader (core/admin/mailu/ui/templates/**.html) - deleted unused/broken /user/forward route (core/admin/mailu/ui/templates/user/forward.html) (core/admin/mailu/ui/views/users.py) - updated gunicorn to 20.1.0 to get rid of buffering error at startup (core/admin/requirements-prod.txt) - switched webpack to production mode (core/admin/webpack.config.js) - added css and javascript minimization - added pre-compression of assets (gzip) (core/admin/webpack.config.js) (core/admin/package.json) - removed obsolte dependencies - switched from node-sass to dart-sass (core/admin/package.json) - changed startup cleaning message from error to info (core/admin/mailu/utils.py) - move client config to "my account" section when logged in (core/admin/mailu/ui/templates/sidebar.html)
2021-09-02 22:49:36 +02:00
@ui.route('/antispam', methods=['GET'])
def antispam():
return flask.render_template('antispam.html')