Skip to content

Commit 59ba1fa

Browse files
Merge pull request #266 from supertokens/fix/existing-email-field-error
2 parents e210b2c + 82796b4 commit 59ba1fa

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Fixes issue of sign up API not sending a `FIELD_ERROR` response in case of duplicate email: https://github.com/supertokens/supertokens-python/issues/264
1313

14+
1415
## [0.11.9] - 2022-12-06
1516

1617
- Fixes issue where if send_email is overridden with a different email, it will reset that email.

supertokens_python/recipe/emailpassword/api/signup.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515

1616
from typing import TYPE_CHECKING, Any
1717

18-
from ..exceptions import raise_form_field_exception
19-
from supertokens_python.recipe.emailpassword.interfaces import (
20-
SignUpOkResult,
21-
SignUpPostEmailAlreadyExistsError,
22-
)
18+
from supertokens_python.recipe.emailpassword.interfaces import SignUpPostOkResult
2319
from supertokens_python.types import GeneralErrorResponse
20+
21+
from ..exceptions import raise_form_field_exception
2422
from ..types import ErrorFormField
2523

2624
if TYPE_CHECKING:
@@ -51,17 +49,17 @@ async def handle_sign_up_api(api_implementation: APIInterface, api_options: APIO
5149
form_fields, api_options, user_context
5250
)
5351

54-
if isinstance(response, SignUpOkResult):
52+
if isinstance(response, SignUpPostOkResult):
5553
return send_200_response(response.to_json(), api_options.response)
5654
if isinstance(response, GeneralErrorResponse):
5755
return send_200_response(response.to_json(), api_options.response)
58-
if isinstance(response, SignUpPostEmailAlreadyExistsError):
59-
return raise_form_field_exception(
60-
"EMAIL_ALREADY_EXISTS_ERROR",
61-
[
62-
ErrorFormField(
63-
id="email",
64-
error="This email already exists. Please sign in instead.",
65-
)
66-
],
67-
)
56+
57+
return raise_form_field_exception(
58+
"EMAIL_ALREADY_EXISTS_ERROR",
59+
[
60+
ErrorFormField(
61+
id="email",
62+
error="This email already exists. Please sign in instead.",
63+
)
64+
],
65+
)

0 commit comments

Comments
 (0)