Commit 65368e98 authored by Claude Paroz's avatar Claude Paroz

Remove obsolete django-openid-auth support

parent d44360a3
......@@ -21,10 +21,7 @@ Requirements
git clone git://github.com/jazzband/django-debug-toolbar.git
Define USE_DEBUG_TOOLBAR to True in local_settings.py to use it.
5 - [Optional] python-openid and django-openid-auth (see OpenID support
below).
6 - [Optional] python-pyicu for correct sorting in various languages
5 - [Optional] python-pyicu for correct sorting in various languages
Installing all requirements using pip:
......@@ -88,26 +85,6 @@ accounts, inactivate unused roles, ...):
./manage.py run-maintenance
It might be useful to add the command in a cron schedule.
OpenID support
==============
If you want OpenID support, install django-openid-auth package:
https://pypi.python.org/pypi/django-openid-auth/
Set USE_DJANGO_OPENID to True in your local_settings.py.
This package is dependant on the python-openid package to be installed
on your system. Run 'python manage.py syncdb' and here we go!
Note: if you are using MySQL, you should modify a table column in models.py
of django-openid-auth:
Change:
claimed_id = models.TextField(max_length=2047, unique=True)
To:
claimed_id = models.CharField(max_length=255, unique=True)
See bug https://code.djangoproject.com/ticket/2495
Databases
=========
......
......@@ -6,10 +6,6 @@
.login #password{
float:left;
}
.login #openid{
float:right;
margin-top:2em;
}
.login form {
margin-top:1em;
}
......
......@@ -59,7 +59,6 @@ class LoginView(AuthLoginView):
def site_register(request):
openid_path = ''
if request.method == 'POST':
form = RegistrationForm(data = request.POST)
if form.is_valid():
......@@ -67,12 +66,9 @@ def site_register(request):
return HttpResponseRedirect(reverse('register_success'))
else:
form = RegistrationForm()
if 'django_openid_auth' in settings.INSTALLED_APPS:
openid_path = '/openid/'
context = {
'pageSection': 'home',
'form': form,
'openid_path': openid_path,
}
return render(request, 'registration/register.html', context)
......
......@@ -6,7 +6,6 @@ gettext_noop = lambda s: s
DEBUG = True
STATIC_SERVE = True
USE_DEBUG_TOOLBAR = False
USE_DJANGO_OPENID = False
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -193,13 +192,3 @@ if DEBUG:
if USE_DEBUG_TOOLBAR:
MIDDLEWARE.append('debug_toolbar.middleware.DebugToolbarMiddleware')
INSTALLED_APPS.append('debug_toolbar')
if USE_DJANGO_OPENID:
INSTALLED_APPS.append('django_openid_auth')
AUTHENTICATION_BACKENDS = (
'django_openid_auth.auth.OpenIDBackend',
'django.contrib.auth.backends.ModelBackend',
)
OPENID_CREATE_USERS = False
OPENID_UPDATE_DETAILS_FROM_SREG = True
OPENID_UPDATE_DETAILS_FROM_AX = True
......@@ -94,11 +94,6 @@ urlpatterns += [
stats_views.compare_by_releases),
]
if 'django_openid_auth' in settings.INSTALLED_APPS:
urlpatterns += [
(r'^openid/', include('django_openid_auth.urls')),
]
if settings.STATIC_SERVE:
urlpatterns += [
url(r'^media/(?P<path>.*)$',
......
......@@ -21,8 +21,6 @@ class RegistrationForm(forms.Form):
label=ugettext_lazy('Choose a username:'),
help_text=ugettext_lazy('May contain only letters, numbers, underscores or hyphens'))
email = forms.EmailField(label=ugettext_lazy('Email:'))
openid_url = forms.URLField(label=ugettext_lazy('OpenID:'),
required=False)
password1 = forms.CharField(widget=forms.PasswordInput(render_value=False),
label=ugettext_lazy('Password:'), required=False, min_length=7,
help_text=ugettext_lazy('At least 7 characters'))
......@@ -37,25 +35,12 @@ class RegistrationForm(forms.Form):
return self.cleaned_data['username']
raise ValidationError(_('This username is already taken. Please choose another.'))
def clean_openid_url(self):
""" Check openid url is not already linked to any existing user """
if self.cleaned_data['openid_url']:
from django_openid_auth.models import UserOpenID
try:
UserOpenID.objects.get(claimed_id=self.cleaned_data['openid_url'])
except UserOpenID.DoesNotExist:
return self.cleaned_data['openid_url']
raise ValidationError(_('This OpenID URL is already taken by a registered user'))
else:
return self.cleaned_data['openid_url']
def clean(self):
cleaned_data = self.cleaned_data
password1 = cleaned_data.get('password1')
password2 = cleaned_data.get('password2')
openid_url = cleaned_data.get('openid_url')
if not password1 and not openid_url:
raise ValidationError(_('You must either provide an OpenID or a password'))
if not password1:
raise ValidationError(_('You must provide a password'))
if password1 and password1 != password2:
raise ValidationError(_('The passwords do not match'))
......@@ -70,10 +55,6 @@ class RegistrationForm(forms.Form):
new_user = Person.objects.create_user(username=username,
email=email,
password=password or "!")
openid = self.cleaned_data['openid_url']
if openid:
from django_openid_auth.models import UserOpenID
UserOpenID.objects.create(user=new_user, claimed_id=openid)
salt = hashlib.sha1(force_bytes(random.random())).hexdigest()[:5]
activation_key = hashlib.sha1(force_bytes(salt + username)).hexdigest()
new_user.activation_key = activation_key
......
......@@ -31,22 +31,6 @@
</div>
</form>
{% if openid_path %}
<p>{% trans 'Or use your OpenID:' %}</p>
<form action="{{ openid_path }}" method="post" id="openid-login-form" class="login">
{% csrf_token %}
<div class="form-row">
<label for="id_openid_identifier"><img src="{% url 'openid-logo' %}" alt=""> {% trans 'OpenID:' %}</label> <input type="text" name="openid_identifier" id="id_openid_identifier" />
</div>
<div class="submit-row">
<label>&nbsp;</label><input type="submit" value="{% trans 'Log in with OpenID' %}" />
</div>
{% if next %}
<input type="hidden" name="next" value="{{ next }}" />
{% endif %}
</form>
{% endif %}
<script type="text/javascript">
document.getElementById('id_username').focus()
</script>
......
......@@ -24,8 +24,7 @@
<label for="id_email">{{ form.email.label }}</label> {{ form.email }}
</div>
<p class="main_register">{% trans "Authenticate via OpenID <strong>or</strong> password:" %}</p>
<div style="clear:both">{{ form.non_field_errors }}</div>
<div style="clear:both">{{ form.non_field_errors }}</div>
<div class="login">
<div id="password">
......@@ -41,18 +40,6 @@
</div>
</div>
{% if openid_path %}
<div id="openid">
<div class="form-row">
{{ form.openid_url.errors }}
<label for="id_openid_url"><img src="{{ openid_path }}logo/" alt=""> {{ form.openid_url.label }}</label> {{ form.openid_url }}
</div>
<div class="form-row">
<label>&nbsp;</label><input type="submit" value="{% trans 'Register with OpenID' %}" />
</div>
</div>
{% endif %}
</div> <!-- ends div.login -->
</form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment