# from flask import render_template,url_for,redirect,flash,session,request
# from flask_login import login_user,logout_user,current_user,login_required,LoginManager
# # from app import app ,db
# # from app.model import User,add_users
# # from app.form import LoginForm
# # import hashlib


# Login_manager=LoginManager()
# Login_manager.init_app(app)


# @Login_manager.user_loader
# def load_user(user_id):
#     return User.query.get(int(user_id))


# @app.route('/login')
# def login():
#     return render_template('login.html')

# @app.route('/create_user')
# def create_acc():
#     return render_template('create_user.html')

# @app.route('/create',methods=['GET','POST'])
# def create_user():
#     username=request.form.get('uname')
#     email=request.form.get('email')
#     password=request.form.get('psw-repeat')
#     # hashed_password = hash_password(password)
#     # return add_users(username,email,hashed_password)


# ####LOGIN/LOGOUT####
# @app.route('/user_login', methods=['GET','POST'])
# def login_page():
    
#     form_username=request.form.get('uname')
#     form_password=request.form.get('psw')
#     user=User.query.filter_by(username=form_username).first()
#     password=user.password
#     print(password)
#     print(form_password)
#     hashed_Enterpass = hash_password(form_password)
#     print(hashed_Enterpass)

#     if user is None or password !=  hashed_Enterpass:
#         print('hi')
#         flash("Invalid username or passowrd")
#         return redirect(url_for('login'))
#     login_user(user)
#     e=session['username'] = user.username
#     print(e,'ss')
#     # session['password'] = user.password
#     # session.permanent=True
#     return redirect(url_for('home'))

# @app.route('/user_details', methods=['GET','POST'])
# def users():
#     users = User.query.all()
#     user_dicts = [user.__dict__ for user in users]
#     print(user_dicts)
#     return render_template('user_display.html', user_dicts=user_dicts)


# @app.route('/home', methods=['GET','POST'])
# def home():
#     if session:
#         return render_template('homepage.html')
#     return redirect(url_for('login'))

# @app.route('/dashboard')
# def dashboard():
#     if session:
#         return render_template('dashboard.html')
#     return redirect(url_for('login'))

# @app.route('/logout',methods=['GET','POST'])
# def logout():
#     session.clear()
#     print(session)

#     return redirect(url_for('login'))
    


