summaryrefslogtreecommitdiffstats
path: root/django_authopenid/models.py
diff options
context:
space:
mode:
authorEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-06-12 22:51:11 -0400
committerEvgeny Fadeev <evgeny.fadeev@gmail.com>2010-06-12 22:51:11 -0400
commit3a3a11d32c72ab79ce94679aae7a549230c7104f (patch)
tree3ac36a302b85d5497b3d335238044c8f481ac0fd /django_authopenid/models.py
parent8b6a10ead45bcd915f5da223de2b3fd3c30fc7b5 (diff)
downloadaskbot-3a3a11d32c72ab79ce94679aae7a549230c7104f.tar.gz
askbot-3a3a11d32c72ab79ce94679aae7a549230c7104f.tar.bz2
askbot-3a3a11d32c72ab79ce94679aae7a549230c7104f.zip
moved livesettings and django_authopenid into forum/deps
Diffstat (limited to 'django_authopenid/models.py')
-rw-r--r--django_authopenid/models.py80
1 files changed, 0 insertions, 80 deletions
diff --git a/django_authopenid/models.py b/django_authopenid/models.py
deleted file mode 100644
index a12c2fec..00000000
--- a/django_authopenid/models.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# -*- coding: utf-8 -*-
-from django.conf import settings
-from django.contrib.auth.models import User
-from django.db import models
-
-import hashlib, random, sys, os, time
-
-__all__ = ['Nonce', 'Association', 'UserAssociation',
- 'UserPasswordQueueManager', 'UserPasswordQueue']
-
-class Nonce(models.Model):
- """ openid nonce """
- server_url = models.CharField(max_length=255)
- timestamp = models.IntegerField()
- salt = models.CharField(max_length=40)
-
- def __unicode__(self):
- return u"Nonce: %s" % self.id
-
-
-class Association(models.Model):
- """ association openid url and lifetime """
- server_url = models.TextField(max_length=2047)
- handle = models.CharField(max_length=255)
- secret = models.TextField(max_length=255) # Stored base64 encoded
- issued = models.IntegerField()
- lifetime = models.IntegerField()
- assoc_type = models.TextField(max_length=64)
-
- def __unicode__(self):
- return u"Association: %s, %s" % (self.server_url, self.handle)
-
-class UserAssociation(models.Model):
- """
- model to manage association between openid and user
- """
- openid_url = models.CharField(blank=False, max_length=255)
- user = models.ForeignKey(User, unique=True)
-
- def __unicode__(self):
- return "Openid %s with user %s" % (self.openid_url, self.user)
-
-class UserPasswordQueueManager(models.Manager):
- """ manager for UserPasswordQueue object """
- def get_new_confirm_key(self):
- "Returns key that isn't being used."
- # The random module is seeded when this Apache child is created.
- # Use SECRET_KEY as added salt.
- while 1:
- confirm_key = hashlib.md5("%s%s%s%s" % (
- random.randint(0, sys.maxint - 1), os.getpid(),
- time.time(), settings.SECRET_KEY)).hexdigest()
- try:
- self.get(confirm_key=confirm_key)
- except self.model.DoesNotExist:
- break
- return confirm_key
-
-
-class UserPasswordQueue(models.Model):
- """
- model for new password queue.
- """
- user = models.ForeignKey(User, unique=True)
- new_password = models.CharField(max_length=30)
- confirm_key = models.CharField(max_length=40)
-
- objects = UserPasswordQueueManager()
-
- def __unicode__(self):
- return self.user.username
-
-class ExternalLoginData(models.Model):
- """this class was added by Evgeny to associate
- external authentication user with django user
- probably it just does not belong here... (EF)
- """
- external_username = models.CharField(max_length=40, unique=True, null=False)
- external_session_data = models.TextField()
- user = models.ForeignKey(User, null=True)