SarthakFace84 commited on
Commit
69b3a5f
·
1 Parent(s): aa2ec3f

Improve login persistence and add debug logs for authentication

Browse files
Files changed (1) hide show
  1. app/app1.py +3 -1
app/app1.py CHANGED
@@ -216,7 +216,8 @@ def login():
216
  password = request.form.get('password')
217
  user = User.query.filter_by(email=email).first()
218
  if user and bcrypt.check_password_hash(user.password, password):
219
- login_user(user)
 
220
  next_page = request.args.get('next')
221
  return redirect(next_page) if next_page else redirect(url_for('home'))
222
  else:
@@ -233,6 +234,7 @@ def logout():
233
 
234
  @ app1.route('/')
235
  def home():
 
236
  title = 'Harvestify - Home'
237
  return render_template('index.html', title=title)
238
 
 
216
  password = request.form.get('password')
217
  user = User.query.filter_by(email=email).first()
218
  if user and bcrypt.check_password_hash(user.password, password):
219
+ login_user(user, remember=True)
220
+ print(f"User {email} logged in successfully. Authenticated: {current_user.is_authenticated}")
221
  next_page = request.args.get('next')
222
  return redirect(next_page) if next_page else redirect(url_for('home'))
223
  else:
 
234
 
235
  @ app1.route('/')
236
  def home():
237
+ print(f"Home page access. User authenticated: {current_user.is_authenticated}")
238
  title = 'Harvestify - Home'
239
  return render_template('index.html', title=title)
240