mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-10 00:42:06 +00:00

When changing an email, we generate a random token and send it to the new email (the old email is verified by the fact that the user is already logged in). Once the link in the email is clicked, we update the actual email.
20 lines
928 B
Python
20 lines
928 B
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)
|
|
|
|
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)
|