mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +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 %}
|
||||
{{ field }}<br>
|
||||
{% endfor %}
|
||||
<input type="hidden" name="next" value="{{ request.GET.next }}" />
|
||||
<button type="submit">Login</button>
|
||||
</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>
|
||||
|
@ -161,10 +161,13 @@ class LoginView(View):
|
||||
"""handle login post request"""
|
||||
form = AuthenticationForm(data=request.POST)
|
||||
if form.is_valid():
|
||||
next_url = request.POST.get('next') or "home"
|
||||
print(f"next url: {next_url}")
|
||||
user = form.get_user()
|
||||
login(request, user)
|
||||
return redirect(next_url)
|
||||
|
||||
return redirect("/")
|
||||
return redirect("login")
|
||||
|
||||
@staticmethod
|
||||
def read_config():
|
||||
|
Loading…
Reference in New Issue
Block a user