fixes login and the redirect
This commit is contained in:
parent
57213a8cdd
commit
9af2d3aad9
|
@ -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
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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'))
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue