Commit 6f10e8f3d22de654ddba412dcdcccafce1b1b950

Authored by Gust
Committed by Luciano Prestes
1 parent d770229e

Remove conversejs

colab/accounts/forms.py
... ... @@ -16,8 +16,6 @@ from django.utils.text import capfirst
16 16 from django.utils.translation import ugettext_lazy as _
17 17 from django.utils.safestring import mark_safe
18 18  
19   -from conversejs.models import XMPPAccount
20   -
21 19  
22 20 from .utils.validators import validate_social_account
23 21 from .utils import mailman
... ... @@ -152,42 +150,6 @@ class ListsForm(forms.Form):
152 150 choices=LISTS_NAMES)
153 151  
154 152  
155   -class ChangeXMPPPasswordForm(forms.ModelForm):
156   - password1 = forms.CharField(label=_("Password"),
157   - widget=forms.PasswordInput)
158   - password2 = forms.CharField(label=_("Password confirmation"),
159   - widget=forms.PasswordInput,
160   - help_text=_(("Enter the same password as above"
161   - ", for verification.")))
162   -
163   - class Meta:
164   - model = XMPPAccount
165   - fields = ('password1', 'password2')
166   -
167   - def __init__(self, *args, **kwargs):
168   - super(ChangeXMPPPasswordForm, self).__init__(*args, **kwargs)
169   -
170   - for field_name, field in self.fields.items():
171   - # Adds form-control class to all form fields
172   - field.widget.attrs.update({'class': 'form-control'})
173   -
174   - def clean_password2(self):
175   - password1 = self.cleaned_data.get("password1")
176   - password2 = self.cleaned_data.get("password2")
177   - if password1 and password2 and password1 != password2:
178   - raise forms.ValidationError(
179   - _("Password mismatch"),
180   - code='password_mismatch',
181   - )
182   - return password2
183   -
184   - def save(self, commit=True):
185   - self.instance.password = self.cleaned_data['password2']
186   - if commit:
187   - self.instance.save()
188   - return self.instance
189   -
190   -
191 153 class UserCreationForm(UserForm):
192 154 """
193 155 A form that creates a user, with no privileges, from the given username and
... ...
colab/accounts/models.py
... ... @@ -47,13 +47,6 @@ class User(AbstractUser):
47 47  
48 48 objects = ColabUserManager()
49 49  
50   - def check_password(self, raw_password):
51   -
52   - if self.xmpp.exists() and raw_password == self.xmpp.first().password:
53   - return True
54   -
55   - return super(User, self).check_password(raw_password)
56   -
57 50 def get_absolute_url(self):
58 51 return reverse('user_profile', kwargs={'username': self.username})
59 52  
... ...
colab/accounts/templates/accounts/change_password.html
... ... @@ -1,21 +0,0 @@
1   -{% extends "base.html" %}
2   -{% load i18n %}
3   -
4   -{% block main-content %}
5   -<form method="POST" role="form">
6   - {% csrf_token %}
7   - <div class="row">
8   - <h2>{% trans "Change XMPP Client and SVN Password" %}</h2>
9   - <div class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
10   - {% for field in form %}
11   - <div class="form-group required{% if field.errors %} alert alert-danger has-error{% endif %}">
12   - <label for="{{ field.name }}" class="control-label">{{ field.label }}</label>
13   - {{ field }}
14   - {{ field.errors }}
15   - </div>
16   - {% endfor %}
17   - <button class="btn btn-primary">{% trans "Change Password" %}</button>
18   - </div>
19   - </div>
20   -</form>
21   -{% endblock %}
colab/accounts/templates/accounts/user_update_form.html
... ... @@ -193,25 +193,6 @@ $(function() {
193 193 </div>
194 194 {% endif %}
195 195 </div>
196   - {% if CONVERSEJS_ENABLED %}
197   - <div class="row">
198   - <div class="col-lg-12">
199   - <div class="panel panel-default">
200   - <div class="panel-heading">
201   - <h3 class="panel-title">
202   - {% trans 'Change Password' %}
203   - </h3>
204   - </div>
205   - <div class="panel-body">
206   - <div class="form-group">
207   - {% 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." %}
208   - </div>
209   - <a href="{% url 'change_password' %}" class="btn btn-default pull-right"><span class="icon-warning-sign"></span> {% trans "Change Password" %}</a>
210   - </div>
211   - </div>
212   - </div>
213   - </div>
214   - {% endif %}
215 196 <div class="row">
216 197 <div class="submit">
217 198 <button type="submit" class="btn btn-primary btn-lg btn-block">{% trans "Update" %}</button>
... ...
colab/accounts/urls.py
... ... @@ -3,7 +3,7 @@ from django.conf import settings
3 3 from django.conf.urls import patterns, url
4 4  
5 5 from .views import (UserProfileDetailView, UserProfileUpdateView, LoginView,
6   - ManageUserSubscriptionsView, ChangeXMPPPasswordView)
  6 + ManageUserSubscriptionsView)
7 7  
8 8 from colab.accounts import views
9 9 from django.contrib.auth import views as auth_views
... ... @@ -48,10 +48,6 @@ else:
48 48 urlpatterns += patterns('',
49 49 url(r'^register/?$', 'colab.accounts.views.signup', name='signup'),
50 50  
51   -#FIXME Configure for XMPP
52   -# url(r'^change-password/$',
53   -# ChangeXMPPPasswordView.as_view(), name='change_password'),
54   -
55 51 url(r'^(?P<username>[\w@+.-]+)/?$',
56 52 UserProfileDetailView.as_view(), name='user_profile'),
57 53  
... ...
colab/accounts/views.py
... ... @@ -13,16 +13,13 @@ from django.core.exceptions import PermissionDenied
13 13 from django.views.generic import DetailView, UpdateView, TemplateView
14 14 from django.http import Http404
15 15  
16   -from conversejs import xmpp
17   -from conversejs.models import XMPPAccount
18   -
19 16 from colab.super_archives.models import (EmailAddress,
20 17 EmailAddressValidation)
21 18 from colab.search.utils import get_collaboration_data, get_visible_threads
22 19 from colab.accounts.models import User
23 20  
24 21 from .forms import (UserCreationForm, UserForm, ListsForm,
25   - UserUpdateForm, ChangeXMPPPasswordForm)
  22 + UserUpdateForm)
26 23 from .utils import mailman
27 24  
28 25  
... ... @@ -52,11 +49,6 @@ class UserProfileUpdateView(UserProfileBaseMixin, UpdateView):
52 49  
53 50 return obj
54 51  
55   - def get_context_data(self, **kwargs):
56   - context = super(UserProfileUpdateView, self).get_context_data(**kwargs)
57   - context['CONVERSEJS_ENABLED'] = getattr(settings, 'CONVERSEJS_ENABLED')
58   - return context
59   -
60 52  
61 53 class UserProfileDetailView(UserProfileBaseMixin, DetailView):
62 54 template_name = 'accounts/user_detail.html'
... ... @@ -208,50 +200,6 @@ class ManageUserSubscriptionsView(UserProfileBaseMixin, DetailView):
208 200 self).get_context_data(**context)
209 201  
210 202  
211   -class ChangeXMPPPasswordView(UpdateView):
212   - model = XMPPAccount
213   - form_class = ChangeXMPPPasswordForm
214   - fields = ['password', ]
215   - template_name = 'accounts/change_password.html'
216   -
217   - def get_success_url(self):
218   - return reverse('user_profile', kwargs={
219   - 'username': self.request.user.username
220   - })
221   -
222   - def get_object(self, queryset=None):
223   - obj = get_object_or_404(XMPPAccount, user=self.request.user.pk)
224   - self.old_password = obj.password
225   - return obj
226   -
227   - def form_valid(self, form):
228   - transaction.set_autocommit(False)
229   -
230   - response = super(ChangeXMPPPasswordView, self).form_valid(form)
231   -
232   - changed = xmpp.change_password(
233   - self.object.jid,
234   - self.old_password,
235   - form.cleaned_data['password1']
236   - )
237   -
238   - if not changed:
239   - messages.error(
240   - self.request,
241   - _(u'Could not change your password. Please, try again later.')
242   - )
243   - transaction.rollback()
244   - return response
245   - else:
246   - transaction.commit()
247   -
248   - messages.success(
249   - self.request,
250   - _("You've changed your password successfully!")
251   - )
252   - return response
253   -
254   -
255 203 def password_changed(request):
256 204 messages.success(request, _('Your password was changed.'))
257 205  
... ...
colab/management/initconfig.py
... ... @@ -43,12 +43,6 @@ ALLOWED_HOSTS = [
43 43 ### Uncomment to enable social networks fields profile
44 44 # SOCIAL_NETWORK_ENABLED = True
45 45  
46   -### Uncomment to enable Converse.js
47   -# CONVERSEJS_ENABLED = True
48   -
49   -### Uncomment to enable auto-registration
50   -# CONVERSEJS_AUTO_REGISTER = 'xmpp.example.com'
51   -
52 46 ## Database settings
53 47 DATABASES = {{
54 48 'default': {{
... ...
colab/settings.py
... ... @@ -45,7 +45,6 @@ INSTALLED_APPS = (
45 45 'cliauth',
46 46 'django_mobile',
47 47 'django_browserid',
48   - 'conversejs',
49 48 'haystack',
50 49 'hitcounter',
51 50 'i18n_model',
... ... @@ -260,14 +259,6 @@ BROWSERID_CREATE_USER = True
260 259  
261 260 REVPROXY_ADD_REMOTE_USER = True
262 261  
263   -# Converse.js settings
264   -# This URL must use SSL in order to keep chat sessions secure
265   -CONVERSEJS_ENABLED = False
266   -CONVERSEJS_BOSH_SERVICE_URL = SITE_URL + '/http-bind'
267   -
268   -CONVERSEJS_ALLOW_CONTACT_REQUESTS = False
269   -CONVERSEJS_SHOW_ONLY_ONLINE_USERS = True
270   -
271 262 # Tastypie settings
272 263 TASTYPIE_DEFAULT_FORMATS = ['json', ]
273 264  
... ...
colab/templates/base.html
1 1 <!DOCTYPE html>
2   -{% load i18n browserid conversejs gravatar %}
  2 +{% load i18n browserid gravatar plugins %}
3 3 {% load static from staticfiles %}
4 4  
5 5 <html>
... ... @@ -43,10 +43,6 @@
43 43 {% block head_js %}{% endblock %}
44 44 {% block head_css %}{% endblock %}
45 45  
46   - {% if not is_mobile %}
47   - {% conversejs_static %}
48   - {% endif %}
49   -
50 46 <link rel="stylesheet" href="{% static 'css/screen.css' %}"
51 47 type="text/css" media="screen" />
52 48  
... ... @@ -107,11 +103,6 @@
107 103  
108 104 {% endblock %}
109 105  
110   - {% if not is_mobile %}
111   - {% conversejs_chatpanel %}
112   - {% conversejs_initialize %}
113   - {% endif %}
114   -
115 106 {% include "tz/set_utc_offset.html" %}
116 107  
117 108 {% if BROWSERID_ENABLED %}
... ...
setup.py
... ... @@ -33,9 +33,6 @@ REQUIREMENTS = [
33 33 'django-browserid==0.11',
34 34 'django-revproxy==0.9.0',
35 35  
36   - # Converse.js (XMPP client)
37   - 'django-conversejs==0.3.4',
38   -
39 36 # Feedzilla (planet) and deps
40 37 'django-common==0.1.51',
41 38 'feedparser==5.1.3',
... ...