mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-19 15:25:51 +00:00
handle next url parameter in login
This commit is contained in:
parent
01ccca16e4
commit
825ebd874e
@ -29,6 +29,7 @@
|
|||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
{{ field }}<br>
|
{{ field }}<br>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<input type="hidden" name="next" value="{{ request.GET.next }}" />
|
||||||
<button type="submit">Login</button>
|
<button type="submit">Login</button>
|
||||||
</form>
|
</form>
|
||||||
<p class="login-links"><span><a href="https://github.com/bbilly1/tubearchivist" target="_blank">Github</a></span> <span><a href="https://github.com/bbilly1/tubearchivist#donate" target="_blank">Donate</a></span></p>
|
<p class="login-links"><span><a href="https://github.com/bbilly1/tubearchivist" target="_blank">Github</a></span> <span><a href="https://github.com/bbilly1/tubearchivist#donate" target="_blank">Donate</a></span></p>
|
||||||
|
@ -161,10 +161,13 @@ class LoginView(View):
|
|||||||
"""handle login post request"""
|
"""handle login post request"""
|
||||||
form = AuthenticationForm(data=request.POST)
|
form = AuthenticationForm(data=request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
next_url = request.POST.get('next') or "home"
|
||||||
|
print(f"next url: {next_url}")
|
||||||
user = form.get_user()
|
user = form.get_user()
|
||||||
login(request, user)
|
login(request, user)
|
||||||
|
return redirect(next_url)
|
||||||
|
|
||||||
return redirect("/")
|
return redirect("login")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read_config():
|
def read_config():
|
||||||
|
Loading…
Reference in New Issue
Block a user