From 6f10e8f3d22de654ddba412dcdcccafce1b1b950 Mon Sep 17 00:00:00 2001 From: Gust Date: Thu, 18 Jun 2015 11:16:37 -0300 Subject: [PATCH] Remove conversejs --- colab/accounts/forms.py | 38 -------------------------------------- colab/accounts/models.py | 7 ------- colab/accounts/templates/accounts/change_password.html | 21 --------------------- colab/accounts/templates/accounts/user_update_form.html | 19 ------------------- colab/accounts/urls.py | 6 +----- colab/accounts/views.py | 54 +----------------------------------------------------- colab/management/initconfig.py | 6 ------ colab/settings.py | 9 --------- colab/templates/base.html | 11 +---------- setup.py | 3 --- 10 files changed, 3 insertions(+), 171 deletions(-) delete mode 100644 colab/accounts/templates/accounts/change_password.html diff --git a/colab/accounts/forms.py b/colab/accounts/forms.py index 7ca63ab..74062dc 100644 --- a/colab/accounts/forms.py +++ b/colab/accounts/forms.py @@ -16,8 +16,6 @@ from django.utils.text import capfirst from django.utils.translation import ugettext_lazy as _ from django.utils.safestring import mark_safe -from conversejs.models import XMPPAccount - from .utils.validators import validate_social_account from .utils import mailman @@ -152,42 +150,6 @@ class ListsForm(forms.Form): choices=LISTS_NAMES) -class ChangeXMPPPasswordForm(forms.ModelForm): - password1 = forms.CharField(label=_("Password"), - widget=forms.PasswordInput) - password2 = forms.CharField(label=_("Password confirmation"), - widget=forms.PasswordInput, - help_text=_(("Enter the same password as above" - ", for verification."))) - - class Meta: - model = XMPPAccount - fields = ('password1', 'password2') - - def __init__(self, *args, **kwargs): - super(ChangeXMPPPasswordForm, self).__init__(*args, **kwargs) - - for field_name, field in self.fields.items(): - # Adds form-control class to all form fields - field.widget.attrs.update({'class': 'form-control'}) - - def clean_password2(self): - password1 = self.cleaned_data.get("password1") - password2 = self.cleaned_data.get("password2") - if password1 and password2 and password1 != password2: - raise forms.ValidationError( - _("Password mismatch"), - code='password_mismatch', - ) - return password2 - - def save(self, commit=True): - self.instance.password = self.cleaned_data['password2'] - if commit: - self.instance.save() - return self.instance - - class UserCreationForm(UserForm): """ A form that creates a user, with no privileges, from the given username and diff --git a/colab/accounts/models.py b/colab/accounts/models.py index 6de95c1..0981c98 100644 --- a/colab/accounts/models.py +++ b/colab/accounts/models.py @@ -47,13 +47,6 @@ class User(AbstractUser): objects = ColabUserManager() - def check_password(self, raw_password): - - if self.xmpp.exists() and raw_password == self.xmpp.first().password: - return True - - return super(User, self).check_password(raw_password) - def get_absolute_url(self): return reverse('user_profile', kwargs={'username': self.username}) diff --git a/colab/accounts/templates/accounts/change_password.html b/colab/accounts/templates/accounts/change_password.html deleted file mode 100644 index 221148d..0000000 --- a/colab/accounts/templates/accounts/change_password.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block main-content %} -
- {% csrf_token %} -
-

{% trans "Change XMPP Client and SVN Password" %}

-
- {% for field in form %} -
- - {{ field }} - {{ field.errors }} -
- {% endfor %} - -
-
-
-{% endblock %} diff --git a/colab/accounts/templates/accounts/user_update_form.html b/colab/accounts/templates/accounts/user_update_form.html index 23b2e2b..4522902 100644 --- a/colab/accounts/templates/accounts/user_update_form.html +++ b/colab/accounts/templates/accounts/user_update_form.html @@ -193,25 +193,6 @@ $(function() { {% endif %} - {% if CONVERSEJS_ENABLED %} -
-
-
-
-

- {% trans 'Change Password' %} -

-
-
-
- {% trans "This feature is available only for those who need to change the password for some reason as having an old user with the same username, forgot your password to commit, usage of other XMPP Client for connection. Usually, you won't need to change this password. Only change it if you are sure about what you are doing." %} -
- {% trans "Change Password" %} -
-
-
-
- {% endif %}
diff --git a/colab/accounts/urls.py b/colab/accounts/urls.py index 01b9988..5b3d522 100644 --- a/colab/accounts/urls.py +++ b/colab/accounts/urls.py @@ -3,7 +3,7 @@ from django.conf import settings from django.conf.urls import patterns, url from .views import (UserProfileDetailView, UserProfileUpdateView, LoginView, - ManageUserSubscriptionsView, ChangeXMPPPasswordView) + ManageUserSubscriptionsView) from colab.accounts import views from django.contrib.auth import views as auth_views @@ -48,10 +48,6 @@ else: urlpatterns += patterns('', url(r'^register/?$', 'colab.accounts.views.signup', name='signup'), -#FIXME Configure for XMPP -# url(r'^change-password/$', -# ChangeXMPPPasswordView.as_view(), name='change_password'), - url(r'^(?P[\w@+.-]+)/?$', UserProfileDetailView.as_view(), name='user_profile'), diff --git a/colab/accounts/views.py b/colab/accounts/views.py index 5188e51..0e6a83d 100644 --- a/colab/accounts/views.py +++ b/colab/accounts/views.py @@ -13,16 +13,13 @@ from django.core.exceptions import PermissionDenied from django.views.generic import DetailView, UpdateView, TemplateView from django.http import Http404 -from conversejs import xmpp -from conversejs.models import XMPPAccount - from colab.super_archives.models import (EmailAddress, EmailAddressValidation) from colab.search.utils import get_collaboration_data, get_visible_threads from colab.accounts.models import User from .forms import (UserCreationForm, UserForm, ListsForm, - UserUpdateForm, ChangeXMPPPasswordForm) + UserUpdateForm) from .utils import mailman @@ -52,11 +49,6 @@ class UserProfileUpdateView(UserProfileBaseMixin, UpdateView): return obj - def get_context_data(self, **kwargs): - context = super(UserProfileUpdateView, self).get_context_data(**kwargs) - context['CONVERSEJS_ENABLED'] = getattr(settings, 'CONVERSEJS_ENABLED') - return context - class UserProfileDetailView(UserProfileBaseMixin, DetailView): template_name = 'accounts/user_detail.html' @@ -208,50 +200,6 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView): self).get_context_data(**context) -class ChangeXMPPPasswordView(UpdateView): - model = XMPPAccount - form_class = ChangeXMPPPasswordForm - fields = ['password', ] - template_name = 'accounts/change_password.html' - - def get_success_url(self): - return reverse('user_profile', kwargs={ - 'username': self.request.user.username - }) - - def get_object(self, queryset=None): - obj = get_object_or_404(XMPPAccount, user=self.request.user.pk) - self.old_password = obj.password - return obj - - def form_valid(self, form): - transaction.set_autocommit(False) - - response = super(ChangeXMPPPasswordView, self).form_valid(form) - - changed = xmpp.change_password( - self.object.jid, - self.old_password, - form.cleaned_data['password1'] - ) - - if not changed: - messages.error( - self.request, - _(u'Could not change your password. Please, try again later.') - ) - transaction.rollback() - return response - else: - transaction.commit() - - messages.success( - self.request, - _("You've changed your password successfully!") - ) - return response - - def password_changed(request): messages.success(request, _('Your password was changed.')) diff --git a/colab/management/initconfig.py b/colab/management/initconfig.py index fe428e0..2df29e3 100644 --- a/colab/management/initconfig.py +++ b/colab/management/initconfig.py @@ -43,12 +43,6 @@ ALLOWED_HOSTS = [ ### Uncomment to enable social networks fields profile # SOCIAL_NETWORK_ENABLED = True -### Uncomment to enable Converse.js -# CONVERSEJS_ENABLED = True - -### Uncomment to enable auto-registration -# CONVERSEJS_AUTO_REGISTER = 'xmpp.example.com' - ## Database settings DATABASES = {{ 'default': {{ diff --git a/colab/settings.py b/colab/settings.py index 6d598ad..91f2624 100644 --- a/colab/settings.py +++ b/colab/settings.py @@ -45,7 +45,6 @@ INSTALLED_APPS = ( 'cliauth', 'django_mobile', 'django_browserid', - 'conversejs', 'haystack', 'hitcounter', 'i18n_model', @@ -260,14 +259,6 @@ BROWSERID_CREATE_USER = True REVPROXY_ADD_REMOTE_USER = True -# Converse.js settings -# This URL must use SSL in order to keep chat sessions secure -CONVERSEJS_ENABLED = False -CONVERSEJS_BOSH_SERVICE_URL = SITE_URL + '/http-bind' - -CONVERSEJS_ALLOW_CONTACT_REQUESTS = False -CONVERSEJS_SHOW_ONLY_ONLINE_USERS = True - # Tastypie settings TASTYPIE_DEFAULT_FORMATS = ['json', ] diff --git a/colab/templates/base.html b/colab/templates/base.html index 7d9271d..29d6e45 100644 --- a/colab/templates/base.html +++ b/colab/templates/base.html @@ -1,5 +1,5 @@ -{% load i18n browserid conversejs gravatar %} +{% load i18n browserid gravatar plugins %} {% load static from staticfiles %} @@ -43,10 +43,6 @@ {% block head_js %}{% endblock %} {% block head_css %}{% endblock %} - {% if not is_mobile %} - {% conversejs_static %} - {% endif %} - @@ -107,11 +103,6 @@ {% endblock %} - {% if not is_mobile %} - {% conversejs_chatpanel %} - {% conversejs_initialize %} - {% endif %} - {% include "tz/set_utc_offset.html" %} {% if BROWSERID_ENABLED %} diff --git a/setup.py b/setup.py index bbadab6..90adc31 100644 --- a/setup.py +++ b/setup.py @@ -33,9 +33,6 @@ REQUIREMENTS = [ 'django-browserid==0.11', 'django-revproxy==0.9.0', - # Converse.js (XMPP client) - 'django-conversejs==0.3.4', - # Feedzilla (planet) and deps 'django-common==0.1.51', 'feedparser==5.1.3', -- libgit2 0.21.2