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

23 lines
643 B
Python
Raw Normal View History

2014-10-22 00:06:27 +03:00
from flask import current_app, render_template, request, redirect, Blueprint, flash, url_for
2015-10-14 06:52:30 +03:00
from flask.ext.login import logout_user
from realms.modules.auth.models import Auth
2013-12-03 22:09:57 +02:00
2014-10-22 00:06:27 +03:00
blueprint = Blueprint('auth', __name__)
2013-12-03 22:09:57 +02:00
2014-08-30 18:06:12 +03:00
@blueprint.route("/login", methods=['GET', 'POST'])
2014-08-20 18:28:25 +03:00
def login():
2015-10-14 06:52:30 +03:00
return render_template("auth/login.html", forms=Auth.login_forms())
2014-08-30 18:06:12 +03:00
2015-10-14 06:52:30 +03:00
@blueprint.route("/logout")
def logout():
logout_user()
flash("You are now logged out")
return redirect(url_for(current_app.config['ROOT_ENDPOINT']))
2014-08-30 18:06:12 +03:00
@blueprint.route("/settings", methods=['GET', 'POST'])
def settings():
return render_template("auth/settings.html")