Update app.py
Browse files
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.
|
| 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
|
| 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:
|