Files
postgres-web/pgweb/account/models.py
Magnus Hagander 7bb76e334f Implement a "cooloff period" for community authentication
This lets us configure some sites that require accounts to have been
in the system for longer than a certain time before they are allowed
to log in to that site. In particular, the wiki is easy to spam, so
we want those users to be in the system for a while before they can
try something like that.

Requires manual sql to be run on all installations:

ALTER TABLE account_communityauthsite ADD COLUMN cooloff_hours int NOT NULL DEFAULT 0;
2015-12-17 16:34:18 +01:00

22 lines
1.1 KiB
Python

from django.db import models
from django.contrib.auth.models import User
class CommunityAuthSite(models.Model):
name = models.CharField(max_length=100, null=False, blank=False,
help_text="Note that the value in this field is shown on the login page, so make sure it's user-friendly!")
redirecturl = models.URLField(max_length=200, null=False, blank=False)
cryptkey = models.CharField(max_length=100, null=False, blank=False,
help_text="Use tools/communityauth/generate_cryptkey.py to create a key")
comment = models.TextField(null=False, blank=True)
cooloff_hours = models.IntegerField(null=False, blank=False, default=0,
help_text="Number of hours a user must have existed in the systems before allowed to log in to this site")
def __unicode__(self):
return self.name
class EmailChangeToken(models.Model):
user = models.ForeignKey(User, null=False, blank=False, unique=True)
email = models.EmailField(max_length=75, null=False, blank=False)
token = models.CharField(max_length=100, null=False, blank=False)
sentat = models.DateTimeField(null=False, blank=False, auto_now=True)