Skip to content

Commit

Permalink
fixed new client for new redirect uris...
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnnsrs committed Nov 25, 2024
1 parent 07398e9 commit ac0f6f5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions fakts/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def create_website_client(
client_id=client_id,
client_secret=client_secret,
oauth2_client=oauth2_client,
redirect_uris=" ".join(config.redirect_uris),
public=config.public,
composition=composition,
)
Expand Down Expand Up @@ -106,6 +107,7 @@ def create_desktop_client(
client_id=client_id,
client_secret=client_secret,
oauth2_client=oauth2_client,
redirect_uris=" ".join(["http://127.0.0.1/", "http://127.0.0.1/callback"]),
composition=composition
)

Expand Down Expand Up @@ -164,6 +166,7 @@ def create_development_client(
client_id=client_id,
client_secret=client_secret,
oauth2_client=oauth2_client,
redirect_uris="",
public=False,
composition=composition
)
Expand Down
17 changes: 17 additions & 0 deletions fakts/migrations/0009_client_redirect_uris.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.5 on 2024-11-25 16:13

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("fakts", "0008_alter_redeemtoken_client"),
]

operations = [
migrations.AddField(
model_name="client",
name="redirect_uris",
field=models.CharField(default=" ", max_length=1000),
),
]
1 change: 1 addition & 0 deletions fakts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class Client(models.Model):
default=enums.ClientKindChoices.DEVELOPMENT.value,
help_text="The kind of transformation",
)
redirect_uris = models.CharField(max_length=1000, default=" ")
public = models.BooleanField(default=False)
token = models.CharField(
default=uuid.uuid4, unique=True, max_length=10000
Expand Down
7 changes: 5 additions & 2 deletions fakts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get_context_data(self, **kwargs):
release = models.Release.objects.filter(app=app, version=x.staging_manifest["version"]).first()
if release:
context["release"] = release
client = models.Client.objects.filter(release=release, kind=x.staging_kind, tenant=self.request.user).first()
client = models.Client.objects.filter(release=release, kind=x.staging_kind, tenant=self.request.user, redirect_uris=" ".join(x.staging_redirect_uris)).first()
if client:
context["client"] = client

Expand Down Expand Up @@ -177,8 +177,11 @@ def form_valid(self, form):
manifest = base_models.Manifest(**device_code.staging_manifest)


redirect_uris = " ".join(device_code.staging_redirect_uris),

client = models.Client.objects.filter(release__app__identifier=device_code.staging_manifest["identifier"], release__version=device_code.staging_manifest["version"], kind=device_code.staging_kind, tenant=self.request.user).first()


client = models.Client.objects.filter(release__app__identifier=device_code.staging_manifest["identifier"], release__version=device_code.staging_manifest["version"], kind=device_code.staging_kind, tenant=self.request.user, redirect_uris=redirect_uris).first()


if not client:
Expand Down

0 comments on commit ac0f6f5

Please sign in to comment.