Skip to content

Commit

Permalink
self review
Browse files Browse the repository at this point in the history
  • Loading branch information
Archmonger committed Dec 29, 2024
1 parent 91587da commit 023df87
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 64 deletions.
6 changes: 3 additions & 3 deletions docs/src/reference/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Mutation functions can be sync or async.

Provides a `#!python NamedTuple` containing `#!python async login` and `#!python async logout` functions.

This hook utilizes the Django's authentication framework in a way that provides **persistent** authentication across WebSocket and HTTP connections.
This hook utilizes the Django's authentication framework in a way that provides **persistent** login.

=== "components.py"

Expand Down Expand Up @@ -307,7 +307,7 @@ This hook utilizes the Django's authentication framework in a way that provides

??? question "Why use this instead of `#!python channels.auth.login`?"

The `#!python channels.auth.*` functions cannot trigger re-renders of your ReactPy components. Additionally, it does not provide persistent authentication when used within ReactPy.
The `#!python channels.auth.*` functions cannot trigger re-renders of your ReactPy components. Additionally, they do not provide persistent authentication when used within ReactPy.

Django's authentication design requires cookies to retain login status. ReactPy is rendered via WebSockets, and browsers do not allow active WebSocket connections to modify cookies.

Expand Down Expand Up @@ -350,7 +350,7 @@ Shortcut that returns the WebSocket or HTTP connection's `#!python User`.

### Use User Data

Store or retrieve a `#!python dict` containing user data specific to the connection's `#!python User`.
Store or retrieve a `#!python dict` containing arbitrary data specific to the connection's `#!python User`.

This hook is useful for storing user-specific data, such as preferences, settings, or any generic key-value pairs.

Expand Down
4 changes: 2 additions & 2 deletions src/reactpy_django/auth/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ async def synchronize_auth_callback(status_code: int, response: str):
)

# If needed, synchronize authenication sessions by configuring all relevant session cookies.
# This is achieved by commanding the client to perform a HTTP request to our session manager endpoint,
# which will set any required cookies.
# This is achieved by commanding the client to perform a HTTP request to our API endpoint
# that will set any required cookies.
if sync_needed:
return HttpRequest(
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.1.4 on 2024-12-23 04:36
# Generated by Django 5.1.4 on 2024-12-29 07:44

from django.db import migrations, models

Expand All @@ -11,9 +11,9 @@ class Migration(migrations.Migration):

operations = [
migrations.CreateModel(
name='AuthSession',
name='AuthToken',
fields=[
('uuid', models.UUIDField(editable=False, primary_key=True, serialize=False, unique=True)),
('value', models.UUIDField(editable=False, primary_key=True, serialize=False, unique=True)),
('session_key', models.CharField(editable=False, max_length=40)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 023df87

Please sign in to comment.