From a3b38a5c327ba45515c75efccbd18e813c27aad0 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Fri, 4 Jun 2021 00:06:28 +0530 Subject: added user sign in --- app/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/__init__.py') 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 -- cgit v1.2.3