RajaThor commited on
Commit
4c2d675
·
verified ·
1 Parent(s): eb890af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -44,14 +44,14 @@ shape_predictor = dlib.shape_predictor(shape_predictor_path)
44
  def authenticate_user(email, password):
45
  try:
46
  user = auth.get_user_by_email(email)
47
- # Check if the password is correct
48
- auth.verify_password(password, user.password)
49
  # The user is successfully fetched, meaning the email and password are valid.
50
  return True, user
51
  except firebase_admin.auth.UserNotFoundError as e:
52
  print(f"User not found error: {str(e)}")
53
  return False, None
54
- except ValueError as e:
55
  print(f"Invalid password error: {str(e)}")
56
  return False, None
57
  except Exception as e:
 
44
  def authenticate_user(email, password):
45
  try:
46
  user = auth.get_user_by_email(email)
47
+ # Check if the password is correct by reauthenticating the user
48
+ user = auth.sign_in_with_email_and_password(email, password)
49
  # The user is successfully fetched, meaning the email and password are valid.
50
  return True, user
51
  except firebase_admin.auth.UserNotFoundError as e:
52
  print(f"User not found error: {str(e)}")
53
  return False, None
54
+ except firebase_admin.auth.InvalidPasswordError as e:
55
  print(f"Invalid password error: {str(e)}")
56
  return False, None
57
  except Exception as e: