mirror of
https://github.com/etnguyen03/tjdests.git
synced 2025-04-29 05:09:49 -04:00
20 lines
481 B
Python
20 lines
481 B
Python
import functools
|
|
|
|
from django.http import HttpRequest
|
|
from django.shortcuts import redirect
|
|
|
|
|
|
def require_accept_tos(func):
|
|
@functools.wraps(func)
|
|
def wrapper(request: HttpRequest, *args, **kwargs):
|
|
if (
|
|
request.user.is_authenticated
|
|
and not request.user.accepted_terms
|
|
and not request.user.is_banned
|
|
):
|
|
return redirect("authentication:tos")
|
|
|
|
return func(request, *args, **kwargs)
|
|
|
|
return wrapper
|