aboutsummaryrefslogtreecommitdiff
path: root/app/__init__.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-04 00:06:28 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-06-04 00:06:28 +0530
commita3b38a5c327ba45515c75efccbd18e813c27aad0 (patch)
tree8de04d697f0489c0ce411d700470d17a83c073eb /app/__init__.py
parent0c4f67c51846815fbd080ded7de740f57fcde506 (diff)
added user sign in
Diffstat (limited to 'app/__init__.py')
-rw-r--r--app/__init__.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/__init__.py b/app/__init__.py
index 7145f96..1c759e7 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -3,12 +3,16 @@ from flask import Flask
from flask_bcrypt import Bcrypt
from flask.cli import AppGroup
from flask_sqlalchemy import SQLAlchemy
+import flask_login
app = Flask(__name__)
app.config.from_object('app.config')
bcrypt = Bcrypt(app)
db = SQLAlchemy(app)
+login_manager = flask_login.LoginManager()
+
+login_manager.init_app(app)
from app.models import User
@@ -22,5 +26,8 @@ def delete_database():
app.cli.add_command(database_cli)
+from app.views import main
-from app.views import main \ No newline at end of file
+@login_manager.user_loader
+def load_user(email):
+ return User.query.filter(User.email == email).first() \ No newline at end of file