tentative for fixing url redirect

This commit is contained in:
Danhia 2022-02-17 12:03:52 +01:00
parent 38dec900aa
commit 76dc026b73
1 changed files with 3 additions and 1 deletions

View File

@ -4,6 +4,7 @@ from django.views.decorators.http import require_POST
from django.views.defaults import bad_request
from django.urls import reverse
from django.shortcuts import redirect
from django.contrib.sites.models import Site
import os
oauth = OAuth()
@ -23,8 +24,9 @@ oauth.register(
def connect(request):
if request.user.userprofileinfo.discord_id:
return bad_request(request, "Already connected")
site = Site.objects.get_current()
redirect_uri = reverse('accounts:connections-connect-discord-authorize')
redirect_uri = request.build_absolute_uri(redirect_uri)
redirect_uri = "https://" + site.domain + redirect_uri
print(redirect_uri)
return oauth.discord.authorize_redirect(request, redirect_uri)