|
|
@ -3,7 +3,6 @@ |
|
|
|
from flask import (Blueprint, request, render_template, flash, url_for, |
|
|
|
from flask import (Blueprint, request, render_template, flash, url_for, |
|
|
|
redirect, session) |
|
|
|
redirect, session) |
|
|
|
from flask.ext.login import login_user, login_required, logout_user |
|
|
|
from flask.ext.login import login_user, login_required, logout_user |
|
|
|
from sqlalchemy.exc import IntegrityError |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from {{cookiecutter.repo_name}}.extensions import login_manager |
|
|
|
from {{cookiecutter.repo_name}}.extensions import login_manager |
|
|
|
from {{cookiecutter.repo_name}}.user.models import User |
|
|
|
from {{cookiecutter.repo_name}}.user.models import User |
|
|
@ -16,10 +15,7 @@ blueprint = Blueprint('public', __name__, static_folder="../static") |
|
|
|
|
|
|
|
|
|
|
|
@login_manager.user_loader |
|
|
|
@login_manager.user_loader |
|
|
|
def load_user(id): |
|
|
|
def load_user(id): |
|
|
|
try: |
|
|
|
return User.get_by_id(int(id)) |
|
|
|
return User.query.get(int(id)) |
|
|
|
|
|
|
|
except Exception: |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route("/", methods=["GET", "POST"]) |
|
|
|
@blueprint.route("/", methods=["GET", "POST"]) |
|
|
|