Skip to content

Commit 7bbcb53

Browse files
committed
Merge branch '0.11' into feat/header-based-auth
2 parents b4809f2 + ce8416e commit 7bbcb53

File tree

24 files changed

+554
-87
lines changed

24 files changed

+554
-87
lines changed

CHANGELOG.md

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

88
## unreleased
99

10+
- Add missing `original` attribute to flask response and remove logic for cases where `response` is `None`
11+
12+
## [0.11.12] - 2022-12-27
13+
- Fix django cookie expiry time format to make it consistent with other frameworks: https://github.com/supertokens/supertokens-python/issues/267
14+
15+
## [0.11.11] - 2022-12-26
16+
17+
- Updates dashboard version
18+
- Updates user GET API for the dashboard recipe
19+
20+
## [0.11.10] - 2022-12-12
21+
22+
- 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
23+
24+
25+
## [0.11.9] - 2022-12-06
26+
27+
- Fixes issue where if send_email is overridden with a different email, it will reset that email.
28+
1029
## [0.11.8] - 2022-11-28
1130

1231
### Added:

html/supertokens_python/constants.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
4040
# License for the specific language governing permissions and limitations
4141
# under the License.
4242
SUPPORTED_CDI_VERSIONS = [&#34;2.9&#34;, &#34;2.10&#34;, &#34;2.11&#34;, &#34;2.12&#34;, &#34;2.13&#34;, &#34;2.14&#34;, &#34;2.15&#34;]
43-
VERSION = &#34;0.11.8&#34;
43+
VERSION = &#34;0.11.12&#34;
4444
TELEMETRY = &#34;/telemetry&#34;
4545
USER_COUNT = &#34;/users/count&#34;
4646
USER_DELETE = &#34;/user/remove&#34;
@@ -53,7 +53,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
5353
FDI_KEY_HEADER = &#34;fdi-version&#34;
5454
API_VERSION = &#34;/apiversion&#34;
5555
API_VERSION_HEADER = &#34;cdi-version&#34;
56-
DASHBOARD_VERSION = &#34;0.2&#34;</code></pre>
56+
DASHBOARD_VERSION = &#34;0.3&#34;</code></pre>
5757
</details>
5858
</section>
5959
<section>

html/supertokens_python/framework/django/django_response.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ <h1 class="title">Module <code>supertokens_python.framework.django.django_respon
7979
key=key,
8080
value=value,
8181
expires=datetime.fromtimestamp(ceil(expires / 1000)).strftime(
82-
&#34;%A, %B %d, %Y %H:%M:%S&#34;
82+
&#34;%a, %d %b %Y %H:%M:%S GMT&#34;
8383
),
8484
path=path,
8585
domain=domain,
@@ -167,7 +167,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
167167
key=key,
168168
value=value,
169169
expires=datetime.fromtimestamp(ceil(expires / 1000)).strftime(
170-
&#34;%A, %B %d, %Y %H:%M:%S&#34;
170+
&#34;%a, %d %b %Y %H:%M:%S GMT&#34;
171171
),
172172
path=path,
173173
domain=domain,
@@ -256,7 +256,7 @@ <h3>Methods</h3>
256256
key=key,
257257
value=value,
258258
expires=datetime.fromtimestamp(ceil(expires / 1000)).strftime(
259-
&#34;%A, %B %d, %Y %H:%M:%S&#34;
259+
&#34;%a, %d %b %Y %H:%M:%S GMT&#34;
260260
),
261261
path=path,
262262
domain=domain,

html/supertokens_python/recipe/dashboard/api/index.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ <h2 class="section-title" id="header-functions">Functions</h2>
427427
</details>
428428
</dd>
429429
<dt id="supertokens_python.recipe.dashboard.api.handle_user_get"><code class="name flex">
430-
<span>async def <span class="ident">handle_user_get</span></span>(<span>_api_interface: <a title="supertokens_python.recipe.dashboard.interfaces.APIInterface" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIInterface">APIInterface</a>, api_options: <a title="supertokens_python.recipe.dashboard.interfaces.APIOptions" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIOptions">APIOptions</a>) ‑> Union[<a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError">UserGetAPINoUserFoundError</a><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse">UserGetAPIOkResponse</a>]</span>
430+
<span>async def <span class="ident">handle_user_get</span></span>(<span>_api_interface: <a title="supertokens_python.recipe.dashboard.interfaces.APIInterface" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIInterface">APIInterface</a>, api_options: <a title="supertokens_python.recipe.dashboard.interfaces.APIOptions" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIOptions">APIOptions</a>) ‑> Union[<a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError">UserGetAPINoUserFoundError</a><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse">UserGetAPIOkResponse</a><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError" href="../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError">UserGetAPIRecipeNotInitialisedError</a>]</span>
431431
</code></dt>
432432
<dd>
433433
<div class="desc"></div>
@@ -437,7 +437,11 @@ <h2 class="section-title" id="header-functions">Functions</h2>
437437
</summary>
438438
<pre><code class="python">async def handle_user_get(
439439
_api_interface: APIInterface, api_options: APIOptions
440-
) -&gt; Union[UserGetAPINoUserFoundError, UserGetAPIOkResponse]:
440+
) -&gt; Union[
441+
UserGetAPINoUserFoundError,
442+
UserGetAPIOkResponse,
443+
UserGetAPIRecipeNotInitialisedError,
444+
]:
441445
user_id = api_options.request.get_query_param(&#34;userId&#34;)
442446
recipe_id = api_options.request.get_query_param(&#34;recipeId&#34;)
443447

@@ -450,6 +454,9 @@ <h2 class="section-title" id="header-functions">Functions</h2>
450454
if not is_valid_recipe_id(recipe_id):
451455
raise_bad_input_exception(&#34;Invalid recipe id&#34;)
452456

457+
if not is_recipe_initialised(recipe_id):
458+
return UserGetAPIRecipeNotInitialisedError()
459+
453460
user_response = await get_user_for_recipe_id(user_id, recipe_id)
454461
if user_response is None:
455462
return UserGetAPINoUserFoundError()

html/supertokens_python/recipe/dashboard/api/userdetails/user_get.html

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.userdetai
3838
APIOptions,
3939
UserGetAPINoUserFoundError,
4040
UserGetAPIOkResponse,
41+
UserGetAPIRecipeNotInitialisedError,
4142
)
42-
from ...utils import is_valid_recipe_id
43+
from ...utils import is_recipe_initialised, is_valid_recipe_id
4344

4445

4546
async def handle_user_get(
4647
_api_interface: APIInterface, api_options: APIOptions
47-
) -&gt; Union[UserGetAPINoUserFoundError, UserGetAPIOkResponse]:
48+
) -&gt; Union[
49+
UserGetAPINoUserFoundError,
50+
UserGetAPIOkResponse,
51+
UserGetAPIRecipeNotInitialisedError,
52+
]:
4853
user_id = api_options.request.get_query_param(&#34;userId&#34;)
4954
recipe_id = api_options.request.get_query_param(&#34;recipeId&#34;)
5055

@@ -57,6 +62,9 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.userdetai
5762
if not is_valid_recipe_id(recipe_id):
5863
raise_bad_input_exception(&#34;Invalid recipe id&#34;)
5964

65+
if not is_recipe_initialised(recipe_id):
66+
return UserGetAPIRecipeNotInitialisedError()
67+
6068
user_response = await get_user_for_recipe_id(user_id, recipe_id)
6169
if user_response is None:
6270
return UserGetAPINoUserFoundError()
@@ -89,7 +97,7 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.api.userdetai
8997
<h2 class="section-title" id="header-functions">Functions</h2>
9098
<dl>
9199
<dt id="supertokens_python.recipe.dashboard.api.userdetails.user_get.handle_user_get"><code class="name flex">
92-
<span>async def <span class="ident">handle_user_get</span></span>(<span>_api_interface: <a title="supertokens_python.recipe.dashboard.interfaces.APIInterface" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIInterface">APIInterface</a>, api_options: <a title="supertokens_python.recipe.dashboard.interfaces.APIOptions" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIOptions">APIOptions</a>) ‑> Union[<a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError">UserGetAPINoUserFoundError</a><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse">UserGetAPIOkResponse</a>]</span>
100+
<span>async def <span class="ident">handle_user_get</span></span>(<span>_api_interface: <a title="supertokens_python.recipe.dashboard.interfaces.APIInterface" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIInterface">APIInterface</a>, api_options: <a title="supertokens_python.recipe.dashboard.interfaces.APIOptions" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.APIOptions">APIOptions</a>) ‑> Union[<a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPINoUserFoundError">UserGetAPINoUserFoundError</a><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkResponse">UserGetAPIOkResponse</a><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError" href="../../interfaces.html#supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError">UserGetAPIRecipeNotInitialisedError</a>]</span>
93101
</code></dt>
94102
<dd>
95103
<div class="desc"></div>
@@ -99,7 +107,11 @@ <h2 class="section-title" id="header-functions">Functions</h2>
99107
</summary>
100108
<pre><code class="python">async def handle_user_get(
101109
_api_interface: APIInterface, api_options: APIOptions
102-
) -&gt; Union[UserGetAPINoUserFoundError, UserGetAPIOkResponse]:
110+
) -&gt; Union[
111+
UserGetAPINoUserFoundError,
112+
UserGetAPIOkResponse,
113+
UserGetAPIRecipeNotInitialisedError,
114+
]:
103115
user_id = api_options.request.get_query_param(&#34;userId&#34;)
104116
recipe_id = api_options.request.get_query_param(&#34;recipeId&#34;)
105117

@@ -112,6 +124,9 @@ <h2 class="section-title" id="header-functions">Functions</h2>
112124
if not is_valid_recipe_id(recipe_id):
113125
raise_bad_input_exception(&#34;Invalid recipe id&#34;)
114126

127+
if not is_recipe_initialised(recipe_id):
128+
return UserGetAPIRecipeNotInitialisedError()
129+
115130
user_response = await get_user_for_recipe_id(user_id, recipe_id)
116131
if user_response is None:
117132
return UserGetAPINoUserFoundError()

html/supertokens_python/recipe/dashboard/interfaces.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ <h1 class="title">Module <code>supertokens_python.recipe.dashboard.interfaces</c
160160
return {&#34;status&#34;: self.status}
161161

162162

163+
class UserGetAPIRecipeNotInitialisedError(APIResponse):
164+
status: str = &#34;RECIPE_NOT_INITIALISED&#34;
165+
166+
def to_json(self) -&gt; Dict[str, Any]:
167+
return {&#34;status&#34;: self.status}
168+
169+
163170
class FeatureNotEnabledError(APIResponse):
164171
status: str = &#34;FEATURE_NOT_ENABLED_ERROR&#34;
165172

@@ -946,6 +953,51 @@ <h3>Methods</h3>
946953
</dd>
947954
</dl>
948955
</dd>
956+
<dt id="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError"><code class="flex name class">
957+
<span>class <span class="ident">UserGetAPIRecipeNotInitialisedError</span></span>
958+
</code></dt>
959+
<dd>
960+
<div class="desc"><p>Helper class that provides a standard way to create an ABC using
961+
inheritance.</p></div>
962+
<details class="source">
963+
<summary>
964+
<span>Expand source code</span>
965+
</summary>
966+
<pre><code class="python">class UserGetAPIRecipeNotInitialisedError(APIResponse):
967+
status: str = &#34;RECIPE_NOT_INITIALISED&#34;
968+
969+
def to_json(self) -&gt; Dict[str, Any]:
970+
return {&#34;status&#34;: self.status}</code></pre>
971+
</details>
972+
<h3>Ancestors</h3>
973+
<ul class="hlist">
974+
<li><a title="supertokens_python.types.APIResponse" href="../../types.html#supertokens_python.types.APIResponse">APIResponse</a></li>
975+
<li>abc.ABC</li>
976+
</ul>
977+
<h3>Class variables</h3>
978+
<dl>
979+
<dt id="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError.status"><code class="name">var <span class="ident">status</span> : str</code></dt>
980+
<dd>
981+
<div class="desc"></div>
982+
</dd>
983+
</dl>
984+
<h3>Methods</h3>
985+
<dl>
986+
<dt id="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError.to_json"><code class="name flex">
987+
<span>def <span class="ident">to_json</span></span>(<span>self) ‑> Dict[str, Any]</span>
988+
</code></dt>
989+
<dd>
990+
<div class="desc"></div>
991+
<details class="source">
992+
<summary>
993+
<span>Expand source code</span>
994+
</summary>
995+
<pre><code class="python">def to_json(self) -&gt; Dict[str, Any]:
996+
return {&#34;status&#34;: self.status}</code></pre>
997+
</details>
998+
</dd>
999+
</dl>
1000+
</dd>
9491001
<dt id="supertokens_python.recipe.dashboard.interfaces.UserMetadataGetAPIOkResponse"><code class="flex name class">
9501002
<span>class <span class="ident">UserMetadataGetAPIOkResponse</span></span>
9511003
<span>(</span><span>data: Dict[str, Any])</span>
@@ -1575,6 +1627,13 @@ <h4><code><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIOkR
15751627
</ul>
15761628
</li>
15771629
<li>
1630+
<h4><code><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError" href="#supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError">UserGetAPIRecipeNotInitialisedError</a></code></h4>
1631+
<ul class="">
1632+
<li><code><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError.status" href="#supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError.status">status</a></code></li>
1633+
<li><code><a title="supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError.to_json" href="#supertokens_python.recipe.dashboard.interfaces.UserGetAPIRecipeNotInitialisedError.to_json">to_json</a></code></li>
1634+
</ul>
1635+
</li>
1636+
<li>
15781637
<h4><code><a title="supertokens_python.recipe.dashboard.interfaces.UserMetadataGetAPIOkResponse" href="#supertokens_python.recipe.dashboard.interfaces.UserMetadataGetAPIOkResponse">UserMetadataGetAPIOkResponse</a></code></h4>
15791638
<ul class="">
15801639
<li><code><a title="supertokens_python.recipe.dashboard.interfaces.UserMetadataGetAPIOkResponse.status" href="#supertokens_python.recipe.dashboard.interfaces.UserMetadataGetAPIOkResponse.status">status</a></code></li>

0 commit comments

Comments
 (0)