Commits

Anonymous committed d2d306e

clean signin. Now allow developer to set forms and template and use AuthentificationForm from auth contrib.
In the same time remove undeeded files from example.

  • Participants
  • Parent commits e15aaee

Comments (0)

Files changed (18)

 *egg
 django_authopenid.egg*
 dist
+*.db
 
 syntax: regexp
 .*\#.*\#$

File django_authopenid/forms.py

 except ImportError:
     from yadis import xri
     
-from django_authopenid.util import clean_next
+from django_authopenid.utils import clean_next
 
 class OpenidSigninForm(forms.Form):
     """ signin form """
     openid_url = forms.CharField(max_length=255, 
             widget=forms.widgets.TextInput(attrs={'class': 'required openid'}))
-    next = forms.CharField(max_length=255, widget=forms.HiddenInput(), 
-            required=False)
-
+            
     def clean_openid_url(self):
         """ test if openid is accepted """
         if 'openid_url' in self.cleaned_data:
                 raise forms.ValidationError(_('i-names are not supported'))
             return self.cleaned_data['openid_url']
 
-    def clean_next(self):
-        """ validate next """
-        if 'next' in self.cleaned_data and self.cleaned_data['next'] != "":
-            self.cleaned_data['next'] = clean_next(self.cleaned_data['next'])
-            return self.cleaned_data['next']
-
-
 attrs_dict = { 'class': 'required login' }
 username_re = re.compile(r'^\w+$')
 
-class OpenidAuthForm(forms.Form):
-    """ legacy account signin form """
-    next = forms.CharField(max_length=255, widget=forms.HiddenInput(), 
-            required=False)
-    username = forms.CharField(max_length=30,  
-            widget=forms.widgets.TextInput(attrs=attrs_dict))
-    password = forms.CharField(max_length=128, 
-            widget=forms.widgets.PasswordInput(attrs=attrs_dict))
-       
-    def __init__(self, data=None, files=None, auto_id='id_%s',
-            prefix=None, initial=None): 
-        super(OpenidAuthForm, self).__init__(data, files, auto_id,
-                prefix, initial)
-        self.user_cache = None
-            
-    def clean_username(self):
-        """ validate username and test if it exists."""
-        if 'username' in self.cleaned_data and \
-                'openid_url' not in self.cleaned_data:
-            if not username_re.search(self.cleaned_data['username']):
-                raise forms.ValidationError(_("Usernames can only contain \
-                    letters, numbers and underscores"))
-            try:
-                user = User.objects.get(
-                        username__exact = self.cleaned_data['username']
-                )
-            except User.DoesNotExist:
-                raise forms.ValidationError(_("This username does not exist \
-                    in our database. Please choose another."))
-            except User.MultipleObjectsReturned:
-                raise forms.ValidationError(u'There is already more than one \
-                    account registered with that username. Please try \
-                    another.')
-            return self.cleaned_data['username']
-
-    def clean_password(self):
-        """" test if password is valid for this username """
-        if 'username' in self.cleaned_data and \
-                'password' in self.cleaned_data:
-            self.user_cache =  authenticate(
-                    username=self.cleaned_data['username'], 
-                    password=self.cleaned_data['password']
-            )
-            if self.user_cache is None:
-                raise forms.ValidationError(_("Please enter a valid \
-                    username and password. Note that both fields are \
-                    case-sensitive."))
-            elif self.user_cache.is_active == False:
-                raise forms.ValidationError(_("This account is inactive."))
-            return self.cleaned_data['password']
-
-    def clean_next(self):
-        """ validate next url """
-        if 'next' in self.cleaned_data and \
-                self.cleaned_data['next'] != "":
-            self.cleaned_data['next'] = clean_next(self.cleaned_data['next'])
-            return self.cleaned_data['next']
-            
-    def get_user(self):
-        """ get authenticated user """
-        return self.user_cache
-            
-
 class OpenidRegisterForm(forms.Form):
     """ openid signin form """
     next = forms.CharField(max_length=255, widget=forms.HiddenInput(), 

File django_authopenid/openid_store.py

+# -*- coding: utf-8 -*-
+# Copyright 2007, 2008, 2009 by Benoît Chesneau <benoitc@e-engura.org>
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import base64
+import operator
+import time
+import urllib
+try:
+    from hashlib import md5 as _md5
+except ImportError:
+    import md5
+    _md5 = md5.new
+   
+from django.db.models.query import Q
+from django.conf import settings
+from openid.association import Association as OIDAssociation
+import openid.store.interface
+import openid.store
+
+from django_authopenid.models import Association, Nonce
+from django_authopenid.utils import OpenID
+
+class DjangoOpenIDStore(openid.store.interface.OpenIDStore):
+    def __init__(self):
+        self.max_nonce_age = 6 * 60 * 60 # Six hours
+    
+    def storeAssociation(self, server_url, association):
+        assoc = Association(
+            server_url = server_url,
+            handle = association.handle,
+            secret = base64.encodestring(association.secret),
+            issued = association.issued,
+            lifetime = association.issued,
+            assoc_type = association.assoc_type
+        )
+        assoc.save()
+    
+    def getAssociation(self, server_url, handle=None):
+        assocs = []
+        if handle is not None:
+            assocs = Association.objects.filter(
+                server_url = server_url, handle = handle
+            )
+        else:
+            assocs = Association.objects.filter(
+                server_url = server_url
+            )
+        if not assocs:
+            return None
+        associations = []
+        for assoc in assocs:
+            association = OIDAssociation(
+                assoc.handle, base64.decodestring(assoc.secret), assoc.issued,
+                assoc.lifetime, assoc.assoc_type
+            )
+            if association.getExpiresIn() == 0:
+                self.removeAssociation(server_url, assoc.handle)
+            else:
+                associations.append((association.issued, association))
+        if not associations:
+            return None
+        return associations[-1][1]
+    
+    def removeAssociation(self, server_url, handle):
+        assocs = list(Association.objects.filter(
+            server_url = server_url, handle = handle
+        ))
+        assocs_exist = len(assocs) > 0
+        for assoc in assocs:
+            assoc.delete()
+        return assocs_exist
+
+    def useNonce(self, server_url, timestamp, salt):
+        if abs(timestamp - time.time()) > openid.store.nonce.SKEW:
+            return False
+        
+        query = [
+                Q(server_url__exact=server_url),
+                Q(timestamp__exact=timestamp),
+                Q(salt__exact=salt),
+        ]
+        try:
+            ononce = Nonce.objects.get(reduce(operator.and_, query))
+        except Nonce.DoesNotExist:
+            ononce = Nonce(
+                    server_url=server_url,
+                    timestamp=timestamp,
+                    salt=salt
+            )
+            ononce.save()
+            return True
+        
+        ononce.delete()
+
+        return False
+   
+    def cleanupNonce(self):
+        Nonce.objects.filter(timestamp<int(time.time()) - nonce.SKEW).delete()
+
+    def cleanupAssociations(self):
+        Association.objects.extra(where=['issued + lifetimeint<(%s)' % time.time()]).delete()
+
+    def getAuthKey(self):
+        # Use first AUTH_KEY_LEN characters of md5 hash of SECRET_KEY
+        return _md5(settings.SECRET_KEY).hexdigest()[:self.AUTH_KEY_LEN]
+    
+    def isDumb(self):
+        return False

File django_authopenid/templates/authopenid/signin.html

 {% endif %}
 {% if form1.errors %}
 <p class="errors">{% trans "Please correct errors below:" %}<br />
-	{% if form1.username.errors %} 
-		<span class="error">{{ form1.username.errors|join:", " }}</span>
+	{% if form2.username.errors %} 
+		<span class="error">{{ form2.username.errors|join:", " }}</span>
 	{% endif %}
-	{% if form1.password.errors %} 
+	{% if form2.password.errors %} 
 		<span class="error">{{ form1.password.errors|join:", " }}</span>
 	{% endif %}
 </p>
 <div class="login">
 
     <form name="fauth" action="{% url user_signin %}" method="post">
-        {{ form1.next }}
+    <input type="hidden" name="next" value="{{ next }}" />
 	<fieldset>
 		<legend>{% trans "Sign In Using Your Account ID" %}</legend>
-		<div class="form-row"><label for="id_username">{% trans "Username:" %}</label><br />{{ form1.username }}</div>
-		<div class="form-row"><label for="id_password">{% trans "Password" %}</label><br />{{ form1.password }}</div>
+		<div class="form-row"><label for="id_username">{% trans "Username:" %}</label><br />{{ form2.username }}</div>
+		<div class="form-row"><label for="id_password">{% trans "Password" %}</label><br />{{ form2.password }}</div>
+		
         <div class="submit-row"><input type="submit" name="blogin" value="{% trans "Sign in" %}"> </div>
         <div>&nbsp;&nbsp;<a href="{{ sendpw_url }}">{% trans "Lost your password ?" %}</a></div>
 	</fieldset>	
 
 <br />
 <form name="fopenid" action="{% url user_signin %}" method="post">
-    {{ form2.next }}
+    <input type="hidden" name="next" value="{{ next }}" />
 	<fieldset>
 		<legend>{% trans "Sign In Using Your OpenID URL" %}</legend>
-        <div class="form-row"><label for="id_openid_ul">{% trans "OpenId URL :" %}</label><br />{{ form2.openid_url }}</div>
+        <div class="form-row"><label for="id_openid_ul">{% trans "OpenId URL :" %}</label><br />{{ form1.openid_url }}</div>
         <div class="submit-row "><input name="bsignin" type="submit" value="{% trans "Sign in with OpenID" %}"></div>
 		
 	</fieldset>

File django_authopenid/utils/__init__.py

 import urllib
 
 from django.conf import settings
-from django.http import str_to_unicode
+from django.http import str_to_unicode, get_host
+from django.utils.html import escape
 from openid.extensions import sreg
-
 try: # needed for some linux distributions like debian
     from openid.yadis import xri
 except ImportError:
     from yadis import xri
 
-__all__ = ['OpenID', 'from_openid_response', 'clean_next']
 
 class OpenID(object):
     def __init__(self, openid_, issued, attrs=None, sreg_=None):
     return OpenID(
         openid_response.identity_url, issued, openid_response.signed_fields, 
          dict(sreg_resp)
-    )
+    )
+    
+def get_url_host(request):
+    if request.is_secure():
+        protocol = 'https'
+    else:
+        protocol = 'http'
+    host = escape(get_host(request))
+    return '%s://%s' % (protocol, host)
+
+def get_full_url(request):
+    return get_url_host(request) + request.get_full_path()

File django_authopenid/views.py

 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
-from django.http import HttpResponseRedirect, get_host
-from django.shortcuts import render_to_response as render
-from django.template import RequestContext, loader, Context
 from django.conf import settings
+from django.contrib.auth import REDIRECT_FIELD_NAME
+from django.contrib.auth.forms import AuthenticationForm
 from django.contrib.auth.models import User
 from django.contrib.auth import login, logout
 from django.contrib.auth.decorators import login_required
+
+from django.http import HttpResponseRedirect
+from django.shortcuts import render_to_response as render
+from django.template import RequestContext, loader, Context
+
+
 from django.core.urlresolvers import reverse
 from django.utils.encoding import smart_unicode
-from django.utils.html import escape
 from django.utils.translation import ugettext as _
 from django.contrib.sites.models import Site
 from django.utils.http import urlquote_plus
 from django_authopenid.models import UserAssociation, UserPasswordQueue
 from django_authopenid.utils import *
 
-
-def get_url_host(request):
-    if request.is_secure():
-        protocol = 'https'
-    else:
-        protocol = 'http'
-    host = escape(get_host(request))
-    return '%s://%s' % (protocol, host)
-
-def get_full_url(request):
-    return get_url_host(request) + request.get_full_path()
-
-
 def ask_openid(request, openid_url, redirect_to, on_failure=None,
         sreg_request=None):
     """ basic function to ask openid and return response """
     return decorated
 
 @not_authenticated
-def signin(request, template_name='authopenid/signin.html'):
+def signin(request, template_name='authopenid/signin.html', redirect_field_name=REDIRECT_FIELD_NAME,
+        openid_form=OpenidSigninForm, auth_form=AuthenticationForm):
     """
     signin page. It manage the legacy authentification (user/password) 
     and authentification with openid.
 
-    url: /signin/
+    :attr request: request object
+    :attr template_name: string, name of template to use
+    :attr redirect_field_name: string, field name used for redirect. by default 'next'
+    :attr openid_form: form use for openid signin, by default `OpenidSigninForm`
+    :attr auth_form: form object used for legacy authentification. 
+    by default AuthentificationForm form auser auth contrib.
     
-    template : authopenid/signin.htm
     """
-
     on_failure = signin_failure
-    next = clean_next(request.GET.get('next'))
-
-    form_signin = OpenidSigninForm(initial={'next':next})
-    form_auth = OpenidAuthForm(initial={'next':next})
-
-    if request.POST:   
+    redirect_to = request.REQUEST.get(redirect_field_name, '')
+    form1 = signin_form()
+    form2 = auth_form()
+    if request.POST:
+        if not redirect_to or '//' in redirect_to or ' ' in redirect_to:
+            redirect_to = settings.LOGIN_REDIRECT_URL
+            
         if 'bsignin' in request.POST.keys():
-            form_signin = OpenidSigninForm(request.POST)
-            if form_signin.is_valid():
-                next = clean_next(form_signin.cleaned_data.get('next'))
+            form1 = OpenidSigninForm(data=request.POST)
+            if form1.is_valid():
                 sreg_req = sreg.SRegRequest(optional=['nickname', 'email'])
-                redirect_to = "%s%s?%s" % (
+                redirect_url = "%s%s?%s" % (
                         get_url_host(request),
                         reverse('user_complete_signin'), 
-                        urllib.urlencode({'next':next})
+                        urllib.urlencode({ REDIRECT_FIELD_NAME: redirect_to })
                 )
-
                 return ask_openid(request, 
-                        form_signin.cleaned_data['openid_url'], 
-                        redirect_to, 
+                        form1.cleaned_data['openid_url'], 
+                        redirect_url, 
                         on_failure=signin_failure, 
                         sreg_request=sreg_req)
-
         elif 'blogin' in request.POST.keys():
             # perform normal django authentification
-            form_auth = OpenidAuthForm(request.POST)
-            if form_auth.is_valid():
-                user_ = form_auth.get_user()
-                login(request, user_)
-                next = clean_next(form_auth.cleaned_data.get('next'))
-                return HttpResponseRedirect(next)
-
-
+            form2 = auth_form(data=request.POST)
+            if form2.is_valid():
+                login(request, form2.get_user())
+                if request.session.test_cookie_worked():
+                    request.session.delete_test_cookie()
+                return HttpResponseRedirect(redirect_to)
     return render(template_name, {
-        'form1': form_auth,
-        'form2': form_signin,
+        'form1': form1,
+        'form2': form2,
+        redirect_field_name: redirect_to,
         'msg':  request.GET.get('msg',''),
         'sendpw_url': reverse('user_sendpw'),
     }, context_instance=RequestContext(request))
             
             return HttpResponseRedirect(next)
     
-    return render(template_name='authopenid/signup.html', {
+    return render(template_name, {
         'form': form,
         'form2': form_signin,
         }, context_instance=RequestContext(request))
         is_openid = False
 
 
-    return render(template_name='authopenid/settings.html', {
+    return render(template_name, {
         'msg': msg,
         'is_openid': is_openid
         }, context_instance=RequestContext(request))

File djauthaupenid_example/templates/authopenid/changeemail.html

-{% extends "base.html" %}
-{% load i18n %}
-
-
-
-
-{% block content %}
-<h4 class="headblue">{% trans "Account: change email" %}</h4>
-
-<p class="settings-descr">{% blocktrans %}This is where you can change the email address associated with your account. Please keep this email address up to date so we can send you a password-reset email if you request one.{% endblocktrans %}</p>
-{% if form.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-	{% if form.email.errors %} 
-		<span class="error">{{ form.email.errors|join:", " }}</span>
-	{% endif %}
-	{% if form.password.errors %} 
-		<span class="error">{{ form.password.errors|join:", " }}</span>
-	{% endif %}
-</p>
-{% endif %}
-{% if msg %}
-<p class="errors">{{ msg }}</p>
-{% endif %}
-
-
-<div class="aligned">
-	<form action="." method="post" accept-charset="utf-8">
-
-		<div id="form-row"><label for="id_email">{% trans "Email" %}</label>{{ form.email }}</div>
-		<div id="form-row"><label for="id_password">{% trans "Password" %}</label>{{ form.password }}</div>
-
-        <p><input type="submit" value="{% trans "Change email" %}"></p>
-
-	</form>
-	</div>
-{% endblock %}

File djauthaupenid_example/templates/authopenid/changeopenid.html

-{% extends "base.html" %}
-{% load i18n %}
-
-{% block content %}
-<h4 class="headblue">{% trans "Account: change openid url" %}</h4>
-
-<p>{% blocktrans %}This is where you can change your openid url used to connect to friendsnippets. Make sure you remember it!{% endblocktrans %}</p>
-{% if form.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-	{% if form.openid_url.errors %} 
-		<span class="error">{{ form.openid_url.errors|join:", " }}</span>
-	{% endif %}
-
-
-</p>
-{% endif %}
-{% if msg %}
-	<p class="errors">{{ msg }}</p>
-{% endif %}
-
-<div class="aligned">
-	<form action="." method="post" accept-charset="utf-8">
-
-		<div id="form-row"><label for="id_openid_url">{% trans "OpenID url:" %}</label>{{ form.openid_url }}</div>
-        <p><input type="submit" value="{% trans "Change openid" %}"></p>
-
-	</form>
-	</div>
-{% endblock %}

File djauthaupenid_example/templates/authopenid/changepw.html

-{% extends "base.html" %}
-{% load i18n %}
-
-{% block head %}
-		
-{% endblock %}
-
-
-
-{% block content %}
-<h4 class="headblue">{% trans "Account: change password" %}</h4>
-
-<p>{% blocktrans %}This is where you can change your password. Make sure you remember it!{% endblocktrans %}</p>
-{% if form.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-{{ form.errors }}
-</p>
-{% endif %}
-
-<div class="aligned">
-	<form action="." method="post" accept-charset="utf-8">
-
-		<div id="form-row"><label for="id_oldpw">{% trans "Old password" %}</label>{{ form.oldpw }}</div>
-		<div id="form-row"><label for="id_password1">{% trans "New password" %}</label>{{ form.password1 }}</div>
-		<div id="form-row"><label for="id_password2">{% trans "New password again" %}</label>{{ form.password2 }}</div>
-        <p><input type="submit" value="{% trans "Change password" %}"></p>
-
-	</form>
-	</div>
-{% endblock %}

File djauthaupenid_example/templates/authopenid/complete.html

-{% extends "base.html" %}
-{% load i18n %}
-
-
-
-{% block head %}{% endblock %}
-
-
-{% block content %}
-
-	<div id="completetxt">
-	<h1>{% trans "Your OpenID is verified! " %}</h1>
-	{% blocktrans %}
-	<p>Your OpenID can now be associated with a new or existing membership. You can change the association later in your preferences</p>
-	{% endblocktrans %}
-	<br /><br />
-	<h2>{% trans "Associate your OpenID" %}</h2>
-	{% blocktrans %}
-	<p>If you're joining <strong>Sitename</strong>, associate your OpenID with a new account. If you're already a member, associate with your existing account.</p>
-	{% endblocktrans %}
-	</div>
-
-		
-	
-	{% if form1.errors %}
-	<p class="errors">{% trans "Please correct errors below:" %}<br />
-		{% if form1.username.errors %} 
-			<span class="error">{{ form1.username.errors|join:", " }}</span>
-		{% endif %}
-		{% if form1.email.errors %} 
-			<span class="error">{{ form1.email.errors|join:", " }}</span>
-		{% endif %}
-	</p>
-	{% endif %}
-	{% if form2.errors %}
-	<p class="errors">{% trans "Please correct errors below:" %}<br />
-		{% if form2.username.errors %} 
-			<span class="error">{{ form2.username.errors|join:", " }}</span>
-		{% endif %}
-		{% if form2.password.errors %} 
-			<span class="error">{{ form2.password.errors|join:", " }}</span>
-		{% endif %}
-	</p>
-	{% endif %}
-
-	<div class="login">
-        <form name="fregister" action="{% url user_register %}" method="POST">
-            {{ form.next }}
-			<fieldset>
-				<legend>{% trans "A new account" %}</legend>
-				<div class="form-row"><label for="id_username">{% trans "Screen name" %}</label><br />{{ form1.username }}</div>
-				<div class="form-row"><label for="id_email">{% trans "Email" %}</label><br />{{ form1.email }}</div>
-				<div class="submit-row"><input type="submit" name="bnewaccount" value="CREATE MY ACCOUNT"></div>
-				<hr class="clear" />
-            	</fieldset>
-		</form>
-	</div>
-
-	
-
-	<div class="login">
-		<h3></h3>
-        <form name="fverify" action="{% url user_register %}" method="POST">
-            {{ form.next }}
-			<fieldset>
-				<legend>{% trans "An exisiting account" %}</legend>
-				<div class="form-row"><label for="id_username">{% trans "Screen name" %}</label><br />{{ form2.username }}</div>
-				<div class="form-row"><label for="id_passwordl">{% trans "Password" %}</label><br />{{ form2.password }}</div>
-				<div class="submit-row"><input type="submit" name="bverify" value="VERIFY"></div>
-			</fieldset>
-		</form>
-	</div>
-{% endblock %}
-
-	
-

File djauthaupenid_example/templates/authopenid/confirm_email.txt

-Thank you for registering. 
-
-Your account details are:
-
-Username: {{ username }}
-Password: {{ password }}
-
-
-You could sign in  with this url:
-{{ site_url }}signin/
-
-

File djauthaupenid_example/templates/authopenid/delete.html

-{% extends "base.html" %}
-{% load i18n %}
-
-
-{% block content %}
-<h4 class="headblue">{% trans "Account: delete account" %}</h4>
-
-<p class="settings-descr">{% blocktrans %}Note: After deleting your account, anyone will be able to register this username.{% endblocktrans %}</p>
-{% if form.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-	{% if form.confirm.errors %} 
-    <span class="error">{% trans "Check confirm box, if you want delete your account." %}</span><br />
-	{% endif %}
-	{% if form.password.errors %} 
-    <span class="error">{% trans "Password:" %} {{ form.password.errors|join:", " }}</span>
-	{% endif %}
-</p>
-{% endif %}
-{% if msg %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-    <span class="error">{{ msg }}</span>
-    </p>
-{% endif %}
-<div class="aligned">
-	<form action="." method="post" accept-charset="utf-8">
-
-        <div id="form-row"> {{ form.confirm }} {% trans "I am sure I want to delete my account." %}</div>
-        <div id="form-row"><label for="id_password">{% trans "Password/ OpenID URL" %}</label>{{ form.password }} {% trans "(required for your security)" %}</div>
-
-        <p><input type="submit" value="{% trans "delete account forever" %}"></p>
-
-	</form>
-	</div>
-{% endblock %}

File djauthaupenid_example/templates/authopenid/failure.html

-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-  "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-  <title>OpenID failed</title>
-</head>
-<body>
-<h1>OpenID failed</h1>
-
-<p>{{ message|escape }}</p>
-
-</body>
-</html>

File djauthaupenid_example/templates/authopenid/sendpw.html

-
-{% extends "base.html" %}
-{% load i18n %}
-
-
-{% block content %}
-<h4 class="headblue">{% trans "Account: Send a new password" %}</h4>
-
-<p class="settings-descr">{% blocktrans %}Lost your password ? Here you can ask to reset your password. Enter the username you use  and you will get a confirm mail with your new password. This new password will be activated only after you clicked on the link you will find in the email{% endblocktrans %}</p>
-{% if form.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-	{% if form.username.errors %} 
-		<span class="error">{{ form.username.errors|join:", " }}</span>
-	{% endif %}
-</p>
-{% endif %}
-{% if msg %}
-<br /
-<span class="error">{{ msg }}</span>
-{% endif %}
-
-<div class="aligned">
-	<form action="." method="post" accept-charset="utf-8">
-		<div id="form-row"><label for="id_username">{% trans "Username" %}</label>{{ form.username }}</div>
-
-        <p><input type="submit" value="{% trans "Send new password" %}"></p>
-
-	</form>
-	</div>
-{% endblock %}

File djauthaupenid_example/templates/authopenid/sendpw_email.txt

-Someone ask to reset your password on {{ site_url }}. 
-If it's not you, please ignore this email. 
-
-Your new account details are:
-
-Username: {{ username }}
-New password: {{ password }}
-
-To confirm reset of your password go on this url:
-{{ site_url }}{{ url_confirm }}?key={{ confirm_key }}
-
-See you,
-

File djauthaupenid_example/templates/authopenid/settings.html

-{% extends "base.html" %}
-{% load i18n %}
-
-{% block head %}
-<style type="text/css" media="screen">
-	dt, dd { padding:0 0 0.35em 0; }
-	dt { float: left; width: 21ex;  }
-	dd { margin-left: 23ex;  }
-	
-	#settings-options, #settings-intro { padding: 4em 1.5em;}
-	#settings-options { min-height: 300px; border-left: 1px solid #333;}
-	
-	#settings-options h5 { font-weight: bold;}
-</style>
-{% endblock %}
-
-{% block content %}
-<div id="settings-intro">
-	
-
-
-    <h4><strong>{{ user.username }}</strong> {% trans "Settings" %}</h4>
-    {% blocktrans %}
-    <p>This is where you can make changes to your account.</p>
-
-    {% endblocktrans %}
-</div>
-
-<div id="settings-options">
-	{% if msg %}
-		<p class="error">{{ msg }}</p>
-	{% endif %}
-    <h5>{% trans "Account" %}</h5>
-	<dl>
-        <dt>» <a href="{% url user_changepw %}">{% trans "change password" %}</a></dt>
-        <dd>{% trans "Give your  account a new password." %}</dd>
-        <dt>» <a href="{% url user_changeemail %}">{% trans "change email" %}</a></dt>
-        <dd>{% trans "Add or update the email address associated with your account." %}</dd>
-        {% if is_openid %}
-        <dt>» <a href="{% url user_changeopenid %}">{% trans "change openid url" %}</a></dt>
-        <dd>{% trans "Change openid associated to your account" %}</dd>
-        {% endif %}
-        
-        <dt>» <a href="{% url user_delete %}">{% trans "delete account" %}</a></dt>
-        <dd>{% trans "Erase your username and all your data from website" %}</dd>
-	</dl>
-</div>
-{% endblock %}

File djauthaupenid_example/templates/authopenid/signin.html

-{% extends "base.html" %}
-{% load i18n %}
-
-{% block head %}
-
-
-{% endblock %}
-
-
-{% block content %}
-{% if msg %}
-<br />
-	<p class="warning">{{ msg }}</p>
-{% endif %}
-{% if form1.errors %}
-<p class="errors">{% trans "Please correct errors below:" %}<br />
-	{% if form1.username.errors %} 
-		<span class="error">{{ form1.username.errors|join:", " }}</span>
-	{% endif %}
-	{% if form1.password.errors %} 
-		<span class="error">{{ form1.password.errors|join:", " }}</span>
-	{% endif %}
-</p>
-{% endif %}
-<div class="login">
-
-    <form name="fauth" action="{% url user_signin %}" method="post">
-        {{ form1.next }}
-	<fieldset>
-		<legend>{% trans "Sign In Using Your Account ID" %}</legend>
-		<div class="form-row"><label for="id_username">{% trans "Username:" %}</label><br />{{ form1.username }}</div>
-		<div class="form-row"><label for="id_password">{% trans "Password" %}</label><br />{{ form1.password }}</div>
-        <div class="submit-row"><input type="submit" name="blogin" value="{% trans "Sign in" %}"> </div>
-        <div>&nbsp;&nbsp;<a href="{{ sendpw_url }}">{% trans "Lost your password ?" %}</a></div>
-	</fieldset>	
-</form>
-
-<br />
-<form name="fopenid" action="{% url user_signin %}" method="post">
-    {{ form2.next }}
-	<fieldset>
-		<legend>{% trans "Sign In Using Your OpenID" %}</legend>
-        <div class="form-row"><label for="id_openid_ul">{% trans "OpenId URL :" %}</label><br />{{ form2.openid_url }}</div>
-        <div class="submit-row "><input name="bsignin" type="submit" value="{% trans "Sign in with OPENID" %}"></div>
-		
-	</fieldset>
-</form>	
-</div>	
-{% endblock %}
-

File djauthaupenid_example/templates/authopenid/signup.html

-{% extends "base.html" %}
-{% load i18n %}
-
-{% block content %}
-
-<div class="jointxt">
-    {% blocktrans %}
-    <h1>Join</h1>
-    <p>There are two ways to join: with an email + screen name, or with OpenID.<br />Enter information only for the type of sign up you want to do.</p>
-    {% endblocktrans %}
-	<br />
-	<br />
-    <h2 class="signup">{% trans "Regular Signup" %}</h2>
-    {% if form.errors %}
-    <p class="errors">{% trans "Please correct errors below:" %}<br />
-    {% if form.username.errors %} 
-    <span class="error">{{ form.username.errors|join:", " }}</span>
-    {% endif %}
-    {% if form.email.errors %} 
-    <span class="error">{{ form.email.errors|join:", " }}</span>
-    {% endif %}
-    {% if form.password2.errors %} 
-    <span class="error">{{ form.password2.errors|join:", " }}</span>
-    {% endif %}
-    </p>
-    {% endif %}
-</div>
-    <form action="{% url user_signup %}" method="post" accept-charset="utf-8">	
-        <div class="form-row"><label for="id_username">{% trans "Choose a Screen Name:" %}</label><br />{{ form.username }}</div>
-
-        <div class="form-row"><label for="id_email">{% trans "Enter Your Email Address:" %}</label><br />{{ form.email }}</div>
-        <div class="form-row"><label for="id_password1">{% trans "Choose a Password:" %}</label><br />{{ form.password1 }}</div>
-        <div class="form-row"><label for="id_password2">{% trans "Confirm Your Password:" %}</label><br />{{ form.password2 }}</div>
-
-        <div class="submit-row"><input type="submit" value="{% trans "JOIN FREE" %}" /></div>
-        <br />
-    </form>
-<br />
-    <h2 class="signup">{% trans "OpenID Signup" %}</h2>
-    <form name="fopenid" action="{% url user_signin %}" method="post">
-        <div class="form-row">{{ form2.openid_url }}</div>
-        <div class="submit-row "><input name="bsignin" type="submit" value="{% trans "Sign in with OPENID" %}"></div>
-    </form>
-{% endblock %}