forked from 42CTF/website
tentative for fixing url redirect
This commit is contained in:
parent
ba0d75c250
commit
3d24fe9b3b
|
@ -4,6 +4,7 @@ from django.views.decorators.http import require_POST
|
||||||
from django.views.defaults import bad_request
|
from django.views.defaults import bad_request
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
from django.contrib.sites.models import Site
|
||||||
import os
|
import os
|
||||||
|
|
||||||
oauth = OAuth()
|
oauth = OAuth()
|
||||||
|
@ -23,8 +24,9 @@ oauth.register(
|
||||||
def connect(request):
|
def connect(request):
|
||||||
if request.user.userprofileinfo.discord_id:
|
if request.user.userprofileinfo.discord_id:
|
||||||
return bad_request(request, "Already connected")
|
return bad_request(request, "Already connected")
|
||||||
|
site = Site.objects.get_current()
|
||||||
redirect_uri = reverse('accounts:connections-connect-discord-authorize')
|
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)
|
print(redirect_uri)
|
||||||
return oauth.discord.authorize_redirect(request, redirect_uri)
|
return oauth.discord.authorize_redirect(request, redirect_uri)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue