Add user post deletion
Users can delete their posts as long as they don't clear their cookies, and as long as server-side user sessions are persistent. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
from django.utils import timezone
|
||||
from django.conf import settings
|
||||
import ipaddress
|
||||
import random
|
||||
import string
|
||||
|
||||
from board.models import Ban, RangeBan
|
||||
|
||||
@@ -45,3 +48,11 @@ def is_banned(ip: str, board: Optional["Board"]) -> bool:
|
||||
return bool(active)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def generate_user_token() -> str:
|
||||
"""
|
||||
Generates a non-secure user token.
|
||||
User tokens need not be secure so this is a simple implementation.
|
||||
"""
|
||||
return "".join(random.choices(string.ascii_letters, k=settings.USER_TOKEN_LENGTH))
|
||||
|
||||
Reference in New Issue
Block a user