Preparing for login rate limiting
This commit is contained in:
parent
e924e18234
commit
3ba7c238cc
2 changed files with 12 additions and 3 deletions
|
@ -8,4 +8,7 @@ from dbsettings.functions import getValue
|
|||
def generate_pwreset_mail(user, token):
|
||||
link = reltoabs(reverse("pwreset", kwargs={"pk": str(token.token)}))
|
||||
template = get_template("backend/auth/pwreset", first_name=user.first_name, link=link, sitename=getValue("core.title", "Expephalon"))
|
||||
return template
|
||||
return template
|
||||
|
||||
def login_fail(user):
|
||||
pass
|
|
@ -1,4 +1,4 @@
|
|||
from django.db.models import Model, ForeignKey, CharField, DateTimeField, UUIDField, CASCADE
|
||||
from django.db.models import Model, ForeignKey, CharField, DateTimeField, UUIDField, CASCADE, BooleanField, IPAddressField
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
from uuid import uuid4
|
||||
|
@ -11,4 +11,10 @@ class LoginSession(Model):
|
|||
class PWResetToken(Model):
|
||||
token = UUIDField(default=uuid4, primary_key=True)
|
||||
user = ForeignKey(get_user_model(), CASCADE)
|
||||
creation = DateTimeField(auto_now_add=True)
|
||||
creation = DateTimeField(auto_now_add=True)
|
||||
|
||||
class LoginLog(Model):
|
||||
user = ForeignKey(get_user_model(), CASCADE)
|
||||
ip = IPAddressField()
|
||||
success = BooleanField()
|
||||
timestamp = DateTimeField(auto_now_add=True)
|
Loading…
Reference in a new issue