realms-wiki/realms/modules/auth/__init__.py

19 lines
456 B
Python
Raw Normal View History

from __future__ import absolute_import
2014-10-31 00:59:19 +02:00
from flask import request, flash, redirect
from flask_login import login_url
2014-10-31 00:59:19 +02:00
2016-08-20 20:37:22 +03:00
from realms import login_manager
2016-09-05 23:54:53 +03:00
modules = set()
2014-10-31 00:59:19 +02:00
2016-09-05 23:54:53 +03:00
2014-10-31 00:59:19 +02:00
@login_manager.unauthorized_handler
def unauthorized():
if request.method == 'GET':
flash('Please log in to access this page')
return redirect(login_url('auth.login', request.url))
else:
return dict(error=True, message="Please log in for access."), 403