Implement login ?next=
This commit is contained in:
parent
4638a71cfb
commit
eb01c38914
@ -1,5 +1,5 @@
|
||||
# Society Self-Service
|
||||
# Copyright © 2018 Yingtong Li (RunasSudo)
|
||||
# Copyright © 2018-2019 Yingtong Li (RunasSudo)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
@ -21,13 +21,18 @@ from django.http import HttpResponse
|
||||
from django.shortcuts import render, redirect
|
||||
from django.urls import reverse
|
||||
|
||||
import urllib.parse
|
||||
|
||||
def index(request):
|
||||
if request.user.is_authenticated:
|
||||
return redirect(reverse('splash'))
|
||||
return render(request, 'ssmain/index.html')
|
||||
|
||||
def login(request):
|
||||
return redirect(reverse('social:begin', args=['google-oauth2']))
|
||||
baseurl = reverse('social:begin', args=['google-oauth2'])
|
||||
if 'next' in request.GET:
|
||||
baseurl += '?' + urllib.parse.urlencode({'next': request.GET['next']})
|
||||
return redirect(baseurl)
|
||||
|
||||
def logout(request):
|
||||
auth_logout(request)
|
||||
|
Loading…
Reference in New Issue
Block a user