diff --git a/src/accounts/auth.py b/src/accounts/auth.py
index 7802acb..03369bc 100644
--- a/src/accounts/auth.py
+++ b/src/accounts/auth.py
@@ -6,5 +6,4 @@ class ColabBrowserIDBackend(BrowserIDBackend):
return self.User.objects.filter(emails__address=email)
def authenticate(self, *args, **kw):
- #import pdb; pdb.set_trace();
return super(ColabBrowserIDBackend, self).authenticate(*args, **kw)
diff --git a/src/accounts/templates/accounts/account_message.html b/src/accounts/templates/accounts/account_message.html
new file mode 100644
index 0000000..43abdf8
--- /dev/null
+++ b/src/accounts/templates/accounts/account_message.html
@@ -0,0 +1,10 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block main-content %}
+
+
+ {% trans msg %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/src/accounts/templates/accounts/email_signup-email-confirmation.html b/src/accounts/templates/accounts/email_signup-email-confirmation.html
new file mode 100644
index 0000000..61c7a67
--- /dev/null
+++ b/src/accounts/templates/accounts/email_signup-email-confirmation.html
@@ -0,0 +1,9 @@
+{% load i18n %}
+
+{% trans "Welcome to the Colab!" %}
+
+{% trans "To activate your account, please confirm your mail's activation by accessing the following link:" %}
+
+
+ http://{{ server_name }}{% url 'email_verification' hash %}
+
diff --git a/src/accounts/templates/accounts/signup-form.html b/src/accounts/templates/accounts/signup-form.html
new file mode 100644
index 0000000..0cac215
--- /dev/null
+++ b/src/accounts/templates/accounts/signup-form.html
@@ -0,0 +1,67 @@
+{% extends "base.html" %}
+{% load form_field %}
+{% load i18n %}
+{% block main-content %}
+
+
{% trans "Sign up" %}
+
+{% if form.errors %}
+{% trans "Please correct the errors below and try again." %}
+{% endif %}
+
+
+
+
+

+
+
+ {% trans "Add an avatar to your account using" %} Gravatar.
+
+
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/src/accounts/templates/accounts/user-profile.html b/src/accounts/templates/accounts/user-profile.html
new file mode 100644
index 0000000..5a46098
--- /dev/null
+++ b/src/accounts/templates/accounts/user-profile.html
@@ -0,0 +1,113 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load form_field %}
+
+{% block head_js %}
+ {% include "pizza-chart.html" with chart_div="collabs" chart_width=390 chart_height=230 %}
+{% endblock %}
+
+{% block main-content %}
+ {% if not user_profile %}
+
+ {% trans "User not registered." %} {% trans "Is that you?" %}
+ {% trans "Click here and sign up." %}
+
+
+ {% else %}
+
+ {% ifequal request.user.username user_profile.user.username %}
+
+ {% trans "Hey, look at you! Do you want to " %}
+ {% trans "update your profile" %}?
+
+ {% endifequal %}
+
+ {% endif %}
+
+
+
{{ email_address.get_full_name }}
+
+
+

+
+
+
+
+
+ {% if type_count %}
+
+
{% trans "Collaborations by Area" %}
+
+
+ {% endif %}
+
+
+
+
+
+
{% trans "Latest posted" %}
+
+ {% for doc in emails %}
+ {% include "message-preview.html" %}
+ {% empty %}
+ - {% trans "There are no posts by this user so far." %}
+ {% endfor %}
+
+
+
+
+
{% trans "Community inside participations" %}
+
+ {% for doc in docs %}
+ {% include "message-preview.html" %}
+ {% empty %}
+ - {% trans "No contributions of this user so far." %}
+ {% endfor %}
+
+
+
+
+{% endblock %}
diff --git a/src/accounts/urls.py b/src/accounts/urls.py
new file mode 100644
index 0000000..df57c68
--- /dev/null
+++ b/src/accounts/urls.py
@@ -0,0 +1,25 @@
+
+from django.conf.urls import patterns, include, url
+
+
+urlpatterns = patterns('',
+
+ url(r'^$', 'accounts.views.signup', name='signup'),
+
+ url(r'^verify/(?P[\w]{32})/$',
+ 'accounts.views.verify_email', name='email_verification'),
+
+ # TODO: review and redo those weird views from
+ # colab.deprecated.views.userprofile moving them to accounts.views
+ url(r'^user/(?P[\w@+.-]+)/?$',
+ 'colab.deprecated.views.userprofile.by_username', name='user_profile'),
+
+ url(r'^user/$', 'colab.deprecated.views.userprofile.by_request_user',
+ name='user_profile_by_request_user'),
+
+ url(r'^user/hash/(?P[\w]+)$',
+ 'colab.deprecated.views.userprofile.by_emailhash'),
+
+ url(r'^user/(?P[\w@+.-]+)/edit/?$',
+ 'colab.deprecated.views.userprofile.update', name='user_profile_update'),
+)
diff --git a/src/accounts/views.py b/src/accounts/views.py
index 60f00ef..43ead34 100644
--- a/src/accounts/views.py
+++ b/src/accounts/views.py
@@ -1 +1,93 @@
-# Create your views here.
+#!/usr/bin/env python
+# encoding: utf-8
+
+import uuid
+from colab.deprecated import signup as signup_
+
+from django.template import RequestContext
+from django.contrib.auth.models import User
+from django.utils.translation import ugettext as _
+from django.shortcuts import render, get_object_or_404
+
+from super_archives.forms import UserCreationForm
+from super_archives.models import UserProfile, EmailAddress
+
+
+def signup(request):
+
+ # If the request method is GET just return the form
+ if request.method == 'GET':
+ form = UserCreationForm()
+ return render(request, 'accounts/signup-form.html', {'form': form})
+
+ # If the request method is POST try to store data
+ form = UserCreationForm(request.POST)
+
+ # If there is validation errors give the form back to the user
+ if not form.is_valid():
+ return render(request, 'accounts/signup-form.html', {'form': form})
+
+ user = User(
+ username=form.cleaned_data.get('username'),
+ email=form.cleaned_data.get('email'),
+ first_name=form.cleaned_data.get('first_name'),
+ last_name=form.cleaned_data.get('last_name'),
+ is_active=False,
+ )
+ user.set_password(form.cleaned_data.get('password1'))
+ user.save()
+
+ profile = UserProfile(
+ user=user,
+ institution=form.cleaned_data.get('institution'),
+ role=form.cleaned_data.get('role'),
+ twitter=form.cleaned_data.get('twitter'),
+ facebook=form.cleaned_data.get('facebook'),
+ google_talk=form.cleaned_data.get('google_talk'),
+ webpage=form.cleaned_data.get('webpage'),
+ verification_hash=uuid.uuid4().get_hex(),
+ )
+ profile.save()
+
+ signup_.send_verification_email(request, user)
+
+ mailing_lists = form.cleaned_data.get('lists')
+ if mailing_lists:
+ signup_.send_email_lists(user, mailing_lists)
+
+
+ # Check if the user's email have been used previously
+ # in the mainling lists to link the user to old messages
+ email_addr, created = EmailAddress.objects.get_or_create(address=user.email)
+ if created:
+ email_addr.real_name = user.get_full_name()
+
+ email_addr.user = user
+ email_addr.save()
+
+ template_data = {
+ 'msg': _((u'Registration completed successfully. Please visit your '
+ u'email address to validate it.')),
+ 'msg_css_class': 'success',
+ }
+
+ return render(request, 'accounts/account_message.html', template_data)
+
+
+def verify_email(request, hash):
+ """Verify hash and activate user's account"""
+
+ profile = get_object_or_404(UserProfile, verification_hash=hash)
+
+ profile.verification_hash = 'verified'
+ profile.save()
+
+ profile.user.is_active = True
+ profile.user.save()
+
+ template_data = {
+ 'msg': _(u'E-mail validated correctly.'),
+ 'msg_css_class': 'success',
+ }
+
+ return render(request, 'accounts/account_message.html', template_data)
diff --git a/src/colab/custom_settings.py b/src/colab/custom_settings.py
index 785e62c..0b14a52 100644
--- a/src/colab/custom_settings.py
+++ b/src/colab/custom_settings.py
@@ -49,11 +49,17 @@ LOGGING = {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s',
},
},
+ 'filters': {
+ 'require_debug_false': {
+ '()': 'django.utils.log.RequireDebugFalse'
+ }
+ },
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'include_html': True,
+ 'filters': ['require_debug_false'],
},
'sentry': {
'level': 'ERROR',
@@ -96,16 +102,6 @@ LOGGING = {
SERVER_EMAIL = '"Colab Interlegis" '
EMAIL_HOST_USER = SERVER_EMAIL
-#SOLR_HOSTNAME = 'solr.interlegis.leg.br'
-SOLR_HOSTNAME = '10.1.2.154'
-SOLR_PORT = '8080'
-SOLR_SELECT_PATH = '/solr/select'
-
-SOLR_COLAB_URI = 'http://colab.interlegis.leg.br'
-SOLR_BASE_QUERY = """
- ((Type:changeset OR Type:ticket OR Type:wiki OR Type:thread) AND Title:["" TO *])
-"""
-
TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
@@ -140,14 +136,40 @@ STATICFILES_DIRS = (
STATIC_ROOT = os.path.join(BASE_DIR, '..', 'www', 'static')
+
+### Proxy configuration
SOCKS_SERVER = None
SOCKS_PORT = None
+
+### Feedzilla (planet)
from feedzilla.settings import *
FEEDZILLA_PAGE_SIZE = 5
FEEDZILLA_SITE_TITLE = gettext(u'Planet Colab')
FEEDZILLA_SITE_DESCRIPTION = gettext(u'Colab blog aggregator')
+
+### BrowserID / Persona
+SITE_URL = 'http://colab.interlegis.leg.br'
+
+LOGIN_REDIRECT_URL = '/'
+LOGIN_REDIRECT_URL_FAILURE = '/'
+LOGOUT_REDIRECT_URL = '/'
+BROWSERID_CREATE_USER = False
+
+
+### Apache Solr
+#SOLR_HOSTNAME = 'solr.interlegis.leg.br'
+SOLR_HOSTNAME = '10.1.2.154'
+SOLR_PORT = '8080'
+SOLR_SELECT_PATH = '/solr/select'
+
+SOLR_COLAB_URI = 'http://colab.interlegis.leg.br'
+SOLR_BASE_QUERY = """
+ ((Type:changeset OR Type:ticket OR Type:wiki OR Type:thread) AND Title:["" TO *])
+"""
+
+
try:
from local_settings import *
except ImportError:
diff --git a/src/colab/deprecated/locale/pt_BR/LC_MESSAGES/django.po b/src/colab/deprecated/locale/pt_BR/LC_MESSAGES/django.po
index 94ac5ec..1d58d00 100644
--- a/src/colab/deprecated/locale/pt_BR/LC_MESSAGES/django.po
+++ b/src/colab/deprecated/locale/pt_BR/LC_MESSAGES/django.po
@@ -37,31 +37,15 @@ msgstr "Não encontrado. Continue procurando! :)"
msgid "Ooopz... something went wrong!"
msgstr "Ooopz... algo saiu errado!"
-#: templates/account_change_password.html:9 templates/signup-form.html:9
+#: templates/signup-form.html:9
msgid "Please correct the errors below and try again."
msgstr "Por favor, corrija os erros abaixo e tente novamente."
-#: templates/account_change_password.html:20
-msgid "Change password"
-msgstr "Alterar senha"
-
-#: templates/account_request_reset_password.html:5 templates/login.html:30
-msgid "I forgot my password"
-msgstr "Esqueci minha senha"
-
-#: templates/account_request_reset_password.html:11
-msgid "User"
-msgstr "Usuário"
-
-#: templates/account_request_reset_password.html:13
-msgid "Send new password"
-msgstr "Enviar nova senha"
-
#: templates/base.html:71 templates/login.html:44 templates/signup-form.html:6
msgid "Sign up"
msgstr "Cadastre-se"
-#: templates/base.html:74 templates/login.html:17
+#: templates/base.html:74
msgid "Login"
msgstr "Login"
@@ -122,27 +106,6 @@ msgstr "O conteúdo deste site está publicado sob a licença"
msgid "Creative Commons - attribution, non-commercial"
msgstr "Creative Commons - atribuição e não-comercial"
-#: templates/email_account-reset-password.html:3
-#, python-format
-msgid ""
-"\n"
-" This email was sent to confirm the password change request \n"
-" to the user's %(username)s of Interlegis Colab. If you have not \n"
-" made the request, please ignore this message.\n"
-msgstr ""
-"\n"
-" Este email foi enviado para confirmar a solicitação de troca de senha \n"
-" para o usuário %(username)s do Colab Interlegis. Caso você não \n"
-" tenha realizado a solicitação por favor ignore esta mensagem.\n"
-
-#: templates/email_account-reset-password.html:12
-msgid ""
-"\n"
-" To perform the password change visit the link below:\n"
-msgstr ""
-"\n"
-" Para realizar a troca de senha acesse o link abaixo:\n"
-
#: templates/email_signup-email-confirmation.html:3
msgid "Welcome to the Colab!"
msgstr "Bem-vindo ao Colab!"
@@ -202,23 +165,6 @@ msgstr "RSS - Últimas Discussões"
msgid "View more discussions..."
msgstr "Ver mais discussões..."
-#: templates/login.html:36
-msgid "Not already registered? Sign up!"
-msgstr "Não possui cadastro? Casdastre-se"
-
-#: templates/login.html:38
-msgid ""
-"To access some features of Colab you must be registered. \n"
-" If you are not already registered systems in the community "
-"Interlegis \n"
-" click on the link below and get to work!\n"
-" "
-msgstr ""
-"Para acessar alguns dos recursos do Colab é necessário estar registrado. \n"
-"Caso você ainda não esteja cadastrado nos sistemas da comunidade "
-"Interlegis \n"
-"clique no link abaixo e comece a colaborar!"
-
#: templates/open-data.html:6
msgid "OpenData - Communities Interlegis"
msgstr "OpenData - Comunidades Interlegis"
diff --git a/src/colab/deprecated/templates/account_change_password.html b/src/colab/deprecated/templates/account_change_password.html
deleted file mode 100644
index b7a7cd1..0000000
--- a/src/colab/deprecated/templates/account_change_password.html
+++ /dev/null
@@ -1,24 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-{% load form_field %}
-
-{% block main-content %}
-
-{% if form.errors %}
-
- {% trans "Please correct the errors below and try again." %}
-
-{% endif %}
-
-
-{% endblock %}
diff --git a/src/colab/deprecated/templates/account_message.html b/src/colab/deprecated/templates/account_message.html
deleted file mode 100644
index 43abdf8..0000000
--- a/src/colab/deprecated/templates/account_message.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-
-{% block main-content %}
-
-
- {% trans msg %}
-
-
-{% endblock %}
\ No newline at end of file
diff --git a/src/colab/deprecated/templates/account_request_reset_password.html b/src/colab/deprecated/templates/account_request_reset_password.html
deleted file mode 100644
index 9c92a2f..0000000
--- a/src/colab/deprecated/templates/account_request_reset_password.html
+++ /dev/null
@@ -1,18 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-
-{% block main-content %}
-{% trans "I forgot my password" %}
-
-
-
-{% endblock %}
diff --git a/src/colab/deprecated/templates/email_account-reset-password.html b/src/colab/deprecated/templates/email_account-reset-password.html
deleted file mode 100644
index ec1f232..0000000
--- a/src/colab/deprecated/templates/email_account-reset-password.html
+++ /dev/null
@@ -1,19 +0,0 @@
-{% load i18n %}
-
-{% blocktrans %}
- This email was sent to confirm the password change request
- to the user's {{ username }} of Interlegis Colab. If you have not
- made the request, please ignore this message.
-{% endblocktrans %}
-
-
-
-
-{% blocktrans %}
- To perform the password change visit the link below:
-{% endblocktrans %}
-
-
-
- http://{{ server_name }}{% url 'reset_password' hash %}
-
diff --git a/src/colab/deprecated/templates/email_signup-email-confirmation.html b/src/colab/deprecated/templates/email_signup-email-confirmation.html
deleted file mode 100644
index 61c7a67..0000000
--- a/src/colab/deprecated/templates/email_signup-email-confirmation.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{% load i18n %}
-
-{% trans "Welcome to the Colab!" %}
-
-{% trans "To activate your account, please confirm your mail's activation by accessing the following link:" %}
-
-
- http://{{ server_name }}{% url 'email_verification' hash %}
-
diff --git a/src/colab/deprecated/templates/signup-form.html b/src/colab/deprecated/templates/signup-form.html
deleted file mode 100644
index 0cac215..0000000
--- a/src/colab/deprecated/templates/signup-form.html
+++ /dev/null
@@ -1,67 +0,0 @@
-{% extends "base.html" %}
-{% load form_field %}
-{% load i18n %}
-{% block main-content %}
-
-{% trans "Sign up" %}
-
-{% if form.errors %}
-{% trans "Please correct the errors below and try again." %}
-{% endif %}
-
-
-
-
-

-
-
- {% trans "Add an avatar to your account using" %} Gravatar.
-
-
-
-
-
-
-
-
-
-{% endblock %}
diff --git a/src/colab/deprecated/templates/user-profile.html b/src/colab/deprecated/templates/user-profile.html
deleted file mode 100644
index 1650b7b..0000000
--- a/src/colab/deprecated/templates/user-profile.html
+++ /dev/null
@@ -1,116 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-{% load form_field %}
-
-{% block head_js %}
- {% include "pizza-chart.html" with chart_div="collabs" chart_width=390 chart_height=230 %}
-{% endblock %}
-
-{% block main-content %}
- {% if not user_profile %}
-
- {% trans "User not registered." %} {% trans "Is that you?" %}
- {% trans "Click here and sign up." %}
-
-
- {% else %}
-
- {% ifequal request.user.username user_profile.user.username %}
-
- {% trans "Hey, look at you! Do you want to " %}
- {% trans "update your profile" %}?
-
- {% endifequal %}
-
- {% endif %}
-
-
-
{{ email_address.get_full_name }}
-
-
-

-
-
-
-
-
- {% if type_count %}
-
-
{% trans "Collaborations by Area" %}
-
-
- {% endif %}
-
-
-
-
-
-
{% trans "Latest posted" %}
-
- {% for doc in emails %}
- {% include "message-preview.html" %}
- {% empty %}
- - {% trans "There are no posts by this user so far." %}
- {% endfor %}
-
-
-
-
-
{% trans "Community inside participations" %}
-
- {% for doc in docs %}
- {% include "message-preview.html" %}
- {% empty %}
- - {% trans "No contributions of this user so far." %}
- {% endfor %}
-
-
-
-
-{% endblock %}
diff --git a/src/colab/deprecated/views/signup.py b/src/colab/deprecated/views/signup.py
deleted file mode 100644
index cb5e892..0000000
--- a/src/colab/deprecated/views/signup.py
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/usr/bin/env python
-# encoding: utf-8
-"""
-signup.py
-
-Created by Sergio Campos on 2012-01-10.
-"""
-
-import uuid
-from colab.deprecated import signup as signup_
-
-from django.template import RequestContext
-from django.contrib.auth.models import User
-from django.utils.translation import ugettext as _
-from django.contrib.auth.decorators import login_required
-from django.contrib.auth.forms import SetPasswordForm, PasswordChangeForm
-from django.shortcuts import render_to_response, redirect, get_object_or_404
-
-from super_archives.forms import UserCreationForm
-from super_archives.models import UserProfile, EmailAddress
-
-
-def signup(request):
-
- # If the request method is GET just return the form
- if request.method == 'GET':
- form = UserCreationForm()
- return render_to_response('signup-form.html', {'form': form},
- RequestContext(request))
-
- # If the request method is POST try to store data
- form = UserCreationForm(request.POST)
-
- # If there is validation errors give the form back to the user
- if not form.is_valid():
- return render_to_response('signup-form.html', {'form': form},
- RequestContext(request))
-
- user = User(
- username=form.cleaned_data.get('username'),
- email=form.cleaned_data.get('email'),
- first_name=form.cleaned_data.get('first_name'),
- last_name=form.cleaned_data.get('last_name'),
- is_active=False,
- )
- user.set_password(form.cleaned_data.get('password1'))
- user.save()
-
- profile = UserProfile(
- user=user,
- institution=form.cleaned_data.get('institution'),
- role=form.cleaned_data.get('role'),
- twitter=form.cleaned_data.get('twitter'),
- facebook=form.cleaned_data.get('facebook'),
- google_talk=form.cleaned_data.get('google_talk'),
- webpage=form.cleaned_data.get('webpage'),
- verification_hash=uuid.uuid4().get_hex(),
- )
- profile.save()
-
- signup_.send_verification_email(request, user)
-
- mailing_lists = form.cleaned_data.get('lists')
- if mailing_lists:
- signup_.send_email_lists(user, mailing_lists)
-
-
- # Check if the user's email have been used previously
- # in the mainling lists to link the user to old messages
- email_addr, created = EmailAddress.objects.get_or_create(address=user.email)
- if created:
- email_addr.real_name = user.get_full_name()
-
- email_addr.user = user
- email_addr.save()
-
- template_data = {
- 'msg': _((u'Registration completed successfully. Please visit your '
- u'email address to validate it.')),
- 'msg_css_class': 'success',
- }
-
- return render_to_response('account_message.html', template_data,
- RequestContext(request))
-
-
-def verify_email(request, hash):
- """Verify hash and activate user's account"""
-
- profile = get_object_or_404(UserProfile, verification_hash=hash)
-
- profile.verification_hash = 'verified'
- profile.save()
-
- profile.user.is_active = True
- profile.user.save()
-
- template_data = {
- 'msg': _(u'E-mail validated correctly.'),
- 'msg_css_class': 'success',
- }
-
- return render_to_response('account_message.html', template_data,
- RequestContext(request))
-
-
-def request_reset_password(request):
- """Request a password reset.
-
- In case request method is GET it will display the password reset
- form. Otherwise we'll look for a username in the POST request to
- have its password reset. This user will receive a link where he
- will be allowed to change his password.
-
- """
-
- if request.method == 'GET':
- return render_to_response('account_request_reset_password.html', {},
- RequestContext(request))
-
- username = request.POST.get('username')
-
- try:
- user = User.objects.get(username=username)
- except User.DoesNotExist:
- user = None
-
- if user and user.is_active:
- profile = user.profile
- profile.verification_hash = uuid.uuid4().get_hex()
- profile.save()
-
- signup_.send_reset_password_email(request, user)
-
- msg = _((u'For your safety, in a few moments you will receive '
- u'an email asking you to confirm the password '
- u'change request. Please wait.'))
-
- template_data = {
- 'msg': msg,
- 'msg_css_class': 'info',
- }
-
- return render_to_response('account_message.html', template_data,
- RequestContext(request))
-
-
-def reset_password(request, hash):
- """Perform a password change.
-
- If the request method is set to GET and the hash matches a form
- will be displayed to the user allowing the password change.
- If the request method is POST the user password will be changed
- to the newly set data.
-
- """
-
- profile = get_object_or_404(UserProfile, verification_hash=hash)
- user = profile.user
-
- form = SetPasswordForm(profile.user)
-
- template_data = {
- 'form': form,
- 'hash': hash,
- }
-
- if request.method == 'GET':
- return render_to_response('account_change_password.html',
- template_data, RequestContext(request))
-
-
- form = SetPasswordForm(user, request.POST)
- template_data.update({'form': form})
-
- if not form.is_valid():
- return render_to_response('account_change_password.html',
- template_data, RequestContext(request))
-
- profile.verification_hash = 'verified'
- profile.save()
-
- user.set_password(form.cleaned_data.get('new_password1'))
- user.save()
-
- template_data.update({
- 'msg': _(u'Password changed successfully!'),
- 'msg_css_class': 'success',
- })
- return render_to_response('account_message.html', template_data,
- RequestContext(request))
-
-@login_required
-def change_password(request):
- """Change a password for an authenticated user."""
-
- form = PasswordChangeForm(request.user)
-
- template_data = {
- 'form': form
- }
-
- if request.method == 'GET':
- return render_to_response('account_change_password.html',
- template_data, RequestContext(request))
-
- form = PasswordChangeForm(request.user, request.POST)
- template_data.update({'form': form})
-
- if not form.is_valid():
- return render_to_response('account_change_password.html',
- template_data, RequestContext(request))
-
- request.user.set_password(form.cleaned_data.get('new_password1'))
- request.user.save()
-
- template_data.update({
- 'msg': _(u'Password changed successfully!'),
- 'msg_css_class': 'success',
- })
- return render_to_response('account_message.html', template_data,
- RequestContext(request))
-
diff --git a/src/colab/deprecated/views/userprofile.py b/src/colab/deprecated/views/userprofile.py
index b71d607..59e65b2 100644
--- a/src/colab/deprecated/views/userprofile.py
+++ b/src/colab/deprecated/views/userprofile.py
@@ -10,55 +10,55 @@ from django.template import RequestContext
from django.contrib.auth.models import User
from django.forms.models import model_to_dict
from django.contrib.auth.decorators import login_required
-from django.shortcuts import render_to_response, get_object_or_404, redirect
+from django.shortcuts import render, get_object_or_404, redirect
from colab.deprecated import solrutils
from super_archives.forms import UserCreationForm, UserUpdateForm
from super_archives.models import Message, UserProfile, EmailAddress
-
+
def read(request, user, email_address=None, editable=False, form=None):
-
+
if form is None:
form = UserCreationForm()
-
+
if user:
email_addresses = user.emails.all()
profile = user.profile
last_modified_docs = solrutils.get_latest_collaborations(
username=user.username
)
-
+
type_count = solrutils.count_types(
filters={'collaborator': user.username}
)
-
+
else:
email_addresses = [email_address]
profile = None
last_modified_docs = []
type_count = {}
-
+
if not email_address and email_addresses:
email_address = email_addresses[0]
email_addresses_ids = tuple([str(addr.id) for addr in email_addresses])
-
+
query = """
- SELECT
- *
+ SELECT
+ *
FROM
super_archives_message JOIN (
SELECT id
FROM super_archives_message
WHERE from_address_id IN (%(ids)s)
GROUP BY thread_id, id
- ) AS subquery
+ ) AS subquery
ON subquery.id = super_archives_message.id
- ORDER BY
+ ORDER BY
received_time DESC
LIMIT 10;
-
+
""" % {'ids': ','.join(email_addresses_ids)}
emails = Message.objects.raw(query)
@@ -73,9 +73,8 @@ def read(request, user, email_address=None, editable=False, form=None):
'type_count': type_count,
'docs': last_modified_docs,
}
-
- return render_to_response('user-profile.html', template_data,
- RequestContext(request))
+
+ return render(request, 'accounts/user-profile.html', template_data)
@login_required
@@ -97,7 +96,7 @@ def by_emailhash(request, emailhash):
def update(request, username):
profile = get_object_or_404(UserProfile, user__username=username)
form = UserUpdateForm(initial=model_to_dict(profile))
-
+
if request.method == "GET":
return read(request, profile.user, editable=True, form=form)
@@ -112,5 +111,5 @@ def update(request, username):
profile.google_talk = form.cleaned_data.get('google_talk')
profile.webpage = form.cleaned_data.get('webpage')
profile.save()
-
+
return redirect('user_profile', profile.user.username)
diff --git a/src/colab/local_settings-dev.py b/src/colab/local_settings-dev.py
index c2a2960..ce2fd5b 100644
--- a/src/colab/local_settings-dev.py
+++ b/src/colab/local_settings-dev.py
@@ -21,12 +21,3 @@ SECRET_KEY = ')(jksdfhsjkadfhjkh234ns!8fqu-1186h$vuj'
#SOCKS_PORT = 9050
SITE_URL = 'http://localhost:8000'
-
-# Path to redirect to on successful login.
-LOGIN_REDIRECT_URL = '/'
-
-# Path to redirect to on unsuccessful login attempt.
-LOGIN_REDIRECT_URL_FAILURE = '/'
-
-# Path to redirect to on logout.
-LOGOUT_REDIRECT_URL = '/'
diff --git a/src/colab/urls.py b/src/colab/urls.py
index f0ac906..1cdfd72 100644
--- a/src/colab/urls.py
+++ b/src/colab/urls.py
@@ -1,56 +1,26 @@
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
-
-# Uncomment the next two lines to enable the admin:
from django.contrib import admin
+
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'colab.deprecated.views.other.home', name='home'),
-
- url(r'^archives/', include('super_archives.urls')),
-
- url(r'^api/', include('api.urls')),
- url(r'^rss/', include('rss.urls')),
+ url(r'^search/$', 'colab.deprecated.views.other.search', name='search'),
url(r'open-data/$', TemplateView.as_view(template_name='open-data.html'),
name='opendata'),
- url(r'^user/(?P[\w@+.-]+)/?$',
- 'colab.deprecated.views.userprofile.by_username', name='user_profile'),
-
- url(r'^user/$', 'colab.deprecated.views.userprofile.by_request_user',
- name='user_profile_by_request_user'),
+ url(r'^archives/', include('super_archives.urls')),
- url(r'^user/hash/(?P[\w]+)$',
- 'colab.deprecated.views.userprofile.by_emailhash'),
+ url(r'^api/', include('api.urls')),
- url(r'^user/(?P[\w@+.-]+)/edit/?$',
- 'colab.deprecated.views.userprofile.update', name='user_profile_update'),
-
- url(r'^search/$', 'colab.deprecated.views.other.search', name='search'),
-
- url(r'^account/$', 'colab.deprecated.views.signup.signup', name='signup'),
-
- url(r'^account/changepassword/$', 'colab.deprecated.views.signup.change_password',
- name='change_password'),
-
- url(r'^account/resetpassword/$',
- 'colab.deprecated.views.signup.request_reset_password',
- name='request_reset_password'),
-
- url(r'^account/reset_password/(?P[\w]{32})/$',
- 'colab.deprecated.views.signup.reset_password', name='reset_password'),
-
- url(r'^signup/verify/(?P[\w]{32})/$',
- 'colab.deprecated.views.signup.verify_email', name='email_verification'),
-
- url(r'^account/login/$', 'django.contrib.auth.views.login',
- {'template_name': 'login.html'}, name='login'),
+ url(r'^rss/', include('rss.urls')),
- url(r'^account/logout/$', 'django.contrib.auth.views.logout',
- {'next_page': '/'}, name='logout'),
+ url(r'^user/', include('accounts.urls')), # Kept for backwards compatibility
+ url(r'^signup/', include('accounts.urls')), # (same here) TODO: move to nginx
+ url(r'^account/', include('accounts.urls')),
url(r'^planet/', include('feedzilla.urls')),
@@ -59,4 +29,3 @@ urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
url(r'^colab/admin/', include(admin.site.urls)),
)
-
--
libgit2 0.21.2