fixes login and the redirect

This commit is contained in:
Oleg Podsadny 2013-06-16 00:17:31 +02:00
parent 57213a8cdd
commit 9af2d3aad9
4 changed files with 16 additions and 3 deletions

View File

@ -17,3 +17,11 @@ class User(db.Model, UserMixin):
role = db.Column(db.SmallInteger, default=ROLE_USER)
active = db.Column(db.Boolean, default=False)
def get_id(self):
return unicode(self.id)
def is_active(self):
return self.active
def is_anonymous(self):
return False

View File

@ -22,3 +22,7 @@ with app.app_context():
app.register_blueprint(auth, url_prefix='/auth')
app.register_blueprint(book)
# Register the views
from .views import *

View File

@ -1,8 +1,8 @@
from flask import render_template
from flask import redirect, url_for
from .app import app
@app.route('/')
def index(template='dashboard.html'):
return render_template(template)
def index():
return redirect(url_for('admin.index'))

View File

@ -17,6 +17,7 @@ def user(password):
username=u'{0}'.format(random_string()),
email="{0}@example.com".format(random_string(7)),
password=password,
active=True,
)
session.add(u)
session.commit()