Changeset 11
- Timestamp:
- 01/04/07 17:03:21 (5 years ago)
- Files:
-
- trunk/djangoid/server/models.py (modified) (3 diffs)
- trunk/djangoid/server/views.py (modified) (2 diffs)
- trunk/djangoid/templates/users/login.html (added)
- trunk/djangoid/urls.py (modified) (1 diff)
- trunk/djangoid/users/models.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/djangoid/server/models.py
r8 r11 24 24 expires = models.IntegerField() 25 25 26 class Admin:27 pass28 29 26 class OidStoreAssociation(models.Model): 30 27 server_url = models.TextField() … … 35 32 assoc_type = models.CharField(maxlength = 64) 36 33 37 class Admin:38 pass39 40 34 class Meta: 41 35 #Django got no multi-column primary keys … … 45 39 setting = models.CharField(maxlength = 128, primary_key = True) 46 40 value = models.TextField() 47 48 class Admin:49 passtrunk/djangoid/server/views.py
r10 r11 19 19 from django.conf import settings 20 20 from django.shortcuts import render_to_response 21 from django.contrib.auth.views import redirect_to_login 21 22 from djangoid.users.models import DjangoidUser 22 23 from djangoid.openidhandlers import checkYadisRequest, convertToOpenIDRequest, convertToHttpResponse, handleOpenIDRequest 23 24 import re 25 import urllib 24 26 25 27 #Regex to extract username out of identity delegate URI, like … … 59 61 #Make sure we pass all OpenID related information in the URL 60 62 if not request.user or request.user.is_authenticated() == False: 61 return HttpResponseRedirect(r.encodeToURL(settings.BASE_URL + "login/"))63 return redirect_to_login(urllib.quote(r.encodeToURL("/".join([""] + settings.BASE_URL.split("/")[3:]))), login_url = settings.BASE_URL + "login/") 62 64 if not request.user.username == user.djangouser: 63 65 raise Exception, "Logged in as " + request.user.username + " while expecting " + user.djangouser trunk/djangoid/urls.py
r8 r11 24 24 (r'^yadis/$', 'djangoid.server.views.serveryadis'), 25 25 (r'^admin/', include('django.contrib.admin.urls')), 26 (r'^login/$', 'django id.users.views.login'),26 (r'^login/$', 'django.contrib.auth.views.login', {"template_name": "users/login.html"}), 27 27 (r'^accept/$', 'djangoid.users.views.accept'), 28 28 (r'^(?P<uid>[^/]+)/yadis/$', 'djangoid.users.views.useryadis'), 29 (r'^(?P<uid>[^/]+)/foaf/$', 'djangoid.users.views.userfoaf'), 29 30 (r'^(?P<uid>[^/]+)/$', 'djangoid.users.views.userpage'), 30 31 (r'^$', 'djangoid.server.views.endpoint'), trunk/djangoid/users/models.py
r10 r11 21 21 #Represent one trusted root URI. Can be shared between several users. 22 22 class TrustedRoot(models.Model): 23 root = models.URLField( primary_key = True)23 root = models.URLField("Trusted root URI", primary_key = True) 24 24 25 25 def __str__(self): … … 34 34 #djangouser = models.ForeignKey(User, primary_key = True) 35 35 #So using an ugly hack... TODO: Fixme! 36 djangouser = models.CharField(' username', maxlength = 30, primary_key = True)37 trusted_roots = models.ManyToManyField(TrustedRoot, blank = True, null = True )36 djangouser = models.CharField('Django user username', maxlength = 30, primary_key = True, help_text = "This should be the username of an existing user in the django.contrib.auth system") 37 trusted_roots = models.ManyToManyField(TrustedRoot, blank = True, null = True, help_text = "URI's trusted by this user") 38 38 39 39 def __str__(self): … … 55 55 #Identities can have attributes. These items represent one possible attribute. 56 56 class IdentityAttribute(models.Model): 57 name = models.CharField( maxlength = 128)58 title = models.CharField( maxlength = 128)59 namespace = models.CharField( maxlength = 32)60 description = models.TextField( blank = True)61 regex = models.CharField( maxlength = 128, blank = True)57 name = models.CharField("Name", maxlength = 128, help_text = "Name of the attribute. In \"openid.sreg.nickname\" this is \"nickname\"") 58 title = models.CharField("Title", maxlength = 128, help_text = "Title of the attribute, as displayed to the user") 59 namespace = models.CharField("Namespace", maxlength = 32, help_text = "Namespace of the attribute. In \"openid.sreg.nickname\" this is \"sreg\"") 60 description = models.TextField("Description", blank = True, help_text = "Longer description of the attribute, as displayed to the user") 61 regex = models.CharField("Validation regex", maxlength = 128, blank = True, help_text = "Regex the value of this field is validated upon on updates") 62 62 63 63 def __str__(self): … … 72 72 #This maps an attribute to a user, including a value, obviously 73 73 class UserAttribute(models.Model): 74 user = models.ForeignKey(DjangoidUser )75 attribute = models.ForeignKey(IdentityAttribute )76 value = models.TextField( )74 user = models.ForeignKey(DjangoidUser, help_text = "DjangoidUser this attribute value belongs to") 75 attribute = models.ForeignKey(IdentityAttribute, help_text = "Attribute of which this is the value for this user") 76 value = models.TextField("Value") 77 77 #True if this attribute's value may be displayed to all trust roots 78 public = models.BooleanField( )78 public = models.BooleanField("Public", help_text = "If this is true, this attribute is returned in all authentication requests, of all trust roots") 79 79 #List of specific trust roots this attribute may be displayed to. 80 80 #If "public" is True, this got no meaning at all 81 public_for = models.ManyToManyField(TrustedRoot, blank = True, null = True )81 public_for = models.ManyToManyField(TrustedRoot, blank = True, null = True, help_text = "List of all trust roots this value should be displayed to. If \"public\" is true, this list got no value") 82 82 83 83 def __str__(self):
