Commit f104580105e2dbfd643d7ca740be8042348a48bb
1 parent
08fa10f3
Exists in
master
and in
39 other branches
Moving accounts releated stuff from deprecated
Showing
20 changed files
with
376 additions
and
620 deletions
Show diff stats
src/accounts/auth.py
@@ -6,5 +6,4 @@ class ColabBrowserIDBackend(BrowserIDBackend): | @@ -6,5 +6,4 @@ class ColabBrowserIDBackend(BrowserIDBackend): | ||
6 | return self.User.objects.filter(emails__address=email) | 6 | return self.User.objects.filter(emails__address=email) |
7 | 7 | ||
8 | def authenticate(self, *args, **kw): | 8 | def authenticate(self, *args, **kw): |
9 | - #import pdb; pdb.set_trace(); | ||
10 | return super(ColabBrowserIDBackend, self).authenticate(*args, **kw) | 9 | return super(ColabBrowserIDBackend, self).authenticate(*args, **kw) |
src/accounts/templates/accounts/email_signup-email-confirmation.html
0 → 100644
@@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
1 | +{% load i18n %} | ||
2 | + | ||
3 | +{% trans "Welcome to the Colab!" %} | ||
4 | + | ||
5 | +{% trans "To activate your account, please confirm your mail's activation by accessing the following link:" %} | ||
6 | + | ||
7 | +<a href="http://{{ server_name }}{% url 'email_verification' hash %}"> | ||
8 | + http://{{ server_name }}{% url 'email_verification' hash %} | ||
9 | +</a> |
@@ -0,0 +1,67 @@ | @@ -0,0 +1,67 @@ | ||
1 | +{% extends "base.html" %} | ||
2 | +{% load form_field %} | ||
3 | +{% load i18n %} | ||
4 | +{% block main-content %} | ||
5 | + | ||
6 | +<h2>{% trans "Sign up" %}</h2> | ||
7 | + | ||
8 | +{% if form.errors %} | ||
9 | +<div class="alert"><b>{% trans "Please correct the errors below and try again." %}</b></div> | ||
10 | +{% endif %} | ||
11 | + | ||
12 | +<div class="avatar-placeholder box"> | ||
13 | + <label class="avatar-placeholder">{% trans "Avatar" %}</label > | ||
14 | + <div class="avatar-image avatar"> | ||
15 | + <img src="{{ STATIC_URL }}img/user.png" alt="user"/> | ||
16 | + </div> | ||
17 | + <p> | ||
18 | + {% trans "Add an avatar to your account using" %} <a href="http://gravatar.com/" target="_blank">Gravatar</a>. | ||
19 | + </p> | ||
20 | +</div> | ||
21 | + | ||
22 | + | ||
23 | +<p class="required span-24 last"> | ||
24 | + <label>{% trans "Required fields" %}</label> | ||
25 | +</p> | ||
26 | + | ||
27 | +<form class="span-24" id="signup" action="." method="post"> | ||
28 | + {% csrf_token %} | ||
29 | + | ||
30 | + <fieldset class="box span-11"> | ||
31 | + <legend>{% trans "Access Information" %}</legend> | ||
32 | + {% render_form_field form.username %} | ||
33 | + {% render_form_field form.password1 %} | ||
34 | + {% render_form_field form.password2 %} | ||
35 | + </fieldset> | ||
36 | + | ||
37 | + <fieldset class="box last"> | ||
38 | + <legend>{% trans "Professionals Information" %}</legend> | ||
39 | + {% render_form_field form.institution %} | ||
40 | + {% render_form_field form.role %} | ||
41 | + </fieldset> | ||
42 | + | ||
43 | + <fieldset class="box span-11"> | ||
44 | + <legend>{% trans "Personal Information" %}</legend> | ||
45 | + {% render_form_field form.first_name %} | ||
46 | + {% render_form_field form.last_name %} | ||
47 | + {% render_form_field form.email %} | ||
48 | + </fieldset> | ||
49 | + | ||
50 | + <fieldset class="box last"> | ||
51 | + <legend>{% trans "Others" %}</legend> | ||
52 | + {% render_form_field form.twitter %} | ||
53 | + {% render_form_field form.facebook %} | ||
54 | + {% render_form_field form.google_talk %} | ||
55 | + {% render_form_field form.webpage %} | ||
56 | + </fieldset> | ||
57 | + | ||
58 | + <fieldset class="box span-11"> | ||
59 | + <legend>{% trans "Subscribe to mail lists" %}</legend> | ||
60 | + {% render_form_field form.lists %} | ||
61 | + </fieldset> | ||
62 | + | ||
63 | + <div class="span-24"> | ||
64 | + <input class="right" type="submit" value="{% trans 'Register' %}"/> | ||
65 | + </div> | ||
66 | +</form> | ||
67 | +{% endblock %} |
@@ -0,0 +1,113 @@ | @@ -0,0 +1,113 @@ | ||
1 | +{% extends "base.html" %} | ||
2 | +{% load i18n %} | ||
3 | +{% load form_field %} | ||
4 | + | ||
5 | +{% block head_js %} | ||
6 | + {% include "pizza-chart.html" with chart_div="collabs" chart_width=390 chart_height=230 %} | ||
7 | +{% endblock %} | ||
8 | + | ||
9 | +{% block main-content %} | ||
10 | + {% if not user_profile %} | ||
11 | + <span class="notice span-24"> | ||
12 | + <b>{% trans "User not registered." %}</b> {% trans "Is that you?" %} | ||
13 | + <a href="{% url 'signup' %}">{% trans "Click here and sign up." %}</a> | ||
14 | + </span> | ||
15 | + | ||
16 | + {% else %} | ||
17 | + | ||
18 | + {% ifequal request.user.username user_profile.user.username %} | ||
19 | + <span class="success span-24"> | ||
20 | + {% trans "Hey, look at you! Do you want to " %} | ||
21 | + <a href="{% url 'user_profile_update' request.user %}">{% trans "update your profile" %}</a>? | ||
22 | + </span> | ||
23 | + {% endifequal %} | ||
24 | + | ||
25 | + {% endif %} | ||
26 | + | ||
27 | + <div id="user-profile"> | ||
28 | + <h2>{{ email_address.get_full_name }}</h2> | ||
29 | + | ||
30 | + <div class="span-4"> | ||
31 | + <img class="avatar" width="120px" heigth="120px" | ||
32 | + src="http://www.gravatar.com/avatar/{{ email_address.md5 }}?s=120&d=identicon" /> | ||
33 | + </div> | ||
34 | + | ||
35 | + <div class="span-20 last"> | ||
36 | + <div class="span-10"> | ||
37 | + <form action="{% url 'user_profile_update' request.user %}" method='post'> | ||
38 | + {% csrf_token %} | ||
39 | + | ||
40 | + <h3>{% trans "Personal Information" %}</h3> | ||
41 | + <ul id="user-info"> | ||
42 | + <li> | ||
43 | + {{ form.username.label_tag }}: {{ user_profile.user.username }} | ||
44 | + </li> | ||
45 | + <li> | ||
46 | + {% render_form_field form.institution user_profile.institution %} | ||
47 | + </li> | ||
48 | + <li> | ||
49 | + {% render_form_field form.role user_profile.role %} | ||
50 | + </li> | ||
51 | + </ul> | ||
52 | + | ||
53 | + <hr class="space" /> | ||
54 | + | ||
55 | + <h3>{% trans "Other informations" %}</h3> | ||
56 | + <ul> | ||
57 | + <li> | ||
58 | + {% render_form_field form.twitter user_profile.twitter %} | ||
59 | + </li> | ||
60 | + <li> | ||
61 | + {% render_form_field form.facebook user_profile.facebook %} | ||
62 | + </li> | ||
63 | + <li> | ||
64 | + {% render_form_field form.google_talk user_profile.google_talk %} | ||
65 | + </li> | ||
66 | + <li> | ||
67 | + {% render_form_field form.webpage user_profile.webpage %} | ||
68 | + </li> | ||
69 | + </ul> | ||
70 | + | ||
71 | + <hr class="space"/> | ||
72 | + {% if editable %} | ||
73 | + <span class="span-5"> | ||
74 | + <input class="right" type="submit" value="{% trans 'Save' %}"/> | ||
75 | + </span> | ||
76 | + {% endif %} | ||
77 | + </form> | ||
78 | + </div> | ||
79 | + | ||
80 | + {% if type_count %} | ||
81 | + <div class="span-10 last"> | ||
82 | + <h3 class="center">{% trans "Collaborations by Area" %}</h3> | ||
83 | + <div id="collabs"></div> | ||
84 | + </div> | ||
85 | + {% endif %} | ||
86 | + </div> | ||
87 | + | ||
88 | + <hr class="space" /> | ||
89 | + | ||
90 | + <div class="span-13"> | ||
91 | + <h3>{% trans "Latest posted" %} </h3> | ||
92 | + <ul class="colborder"> | ||
93 | + {% for doc in emails %} | ||
94 | + {% include "message-preview.html" %} | ||
95 | + {% empty %} | ||
96 | + <li>{% trans "There are no posts by this user so far." %}</li> | ||
97 | + {% endfor %} | ||
98 | + </ul> | ||
99 | + </div> | ||
100 | + | ||
101 | + <div class="span-11 last"> | ||
102 | + <h3>{% trans "Community inside participations" %}</h3> | ||
103 | + <ul> | ||
104 | + {% for doc in docs %} | ||
105 | + {% include "message-preview.html" %} | ||
106 | + {% empty %} | ||
107 | + <li>{% trans "No contributions of this user so far." %}</li> | ||
108 | + {% endfor %} | ||
109 | + </ul> | ||
110 | + </div> | ||
111 | + | ||
112 | + </div> | ||
113 | +{% endblock %} |
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | + | ||
2 | +from django.conf.urls import patterns, include, url | ||
3 | + | ||
4 | + | ||
5 | +urlpatterns = patterns('', | ||
6 | + | ||
7 | + url(r'^$', 'accounts.views.signup', name='signup'), | ||
8 | + | ||
9 | + url(r'^verify/(?P<hash>[\w]{32})/$', | ||
10 | + 'accounts.views.verify_email', name='email_verification'), | ||
11 | + | ||
12 | + # TODO: review and redo those weird views from | ||
13 | + # colab.deprecated.views.userprofile moving them to accounts.views | ||
14 | + url(r'^user/(?P<username>[\w@+.-]+)/?$', | ||
15 | + 'colab.deprecated.views.userprofile.by_username', name='user_profile'), | ||
16 | + | ||
17 | + url(r'^user/$', 'colab.deprecated.views.userprofile.by_request_user', | ||
18 | + name='user_profile_by_request_user'), | ||
19 | + | ||
20 | + url(r'^user/hash/(?P<emailhash>[\w]+)$', | ||
21 | + 'colab.deprecated.views.userprofile.by_emailhash'), | ||
22 | + | ||
23 | + url(r'^user/(?P<username>[\w@+.-]+)/edit/?$', | ||
24 | + 'colab.deprecated.views.userprofile.update', name='user_profile_update'), | ||
25 | +) |
src/accounts/views.py
1 | -# Create your views here. | 1 | +#!/usr/bin/env python |
2 | +# encoding: utf-8 | ||
3 | + | ||
4 | +import uuid | ||
5 | +from colab.deprecated import signup as signup_ | ||
6 | + | ||
7 | +from django.template import RequestContext | ||
8 | +from django.contrib.auth.models import User | ||
9 | +from django.utils.translation import ugettext as _ | ||
10 | +from django.shortcuts import render, get_object_or_404 | ||
11 | + | ||
12 | +from super_archives.forms import UserCreationForm | ||
13 | +from super_archives.models import UserProfile, EmailAddress | ||
14 | + | ||
15 | + | ||
16 | +def signup(request): | ||
17 | + | ||
18 | + # If the request method is GET just return the form | ||
19 | + if request.method == 'GET': | ||
20 | + form = UserCreationForm() | ||
21 | + return render(request, 'accounts/signup-form.html', {'form': form}) | ||
22 | + | ||
23 | + # If the request method is POST try to store data | ||
24 | + form = UserCreationForm(request.POST) | ||
25 | + | ||
26 | + # If there is validation errors give the form back to the user | ||
27 | + if not form.is_valid(): | ||
28 | + return render(request, 'accounts/signup-form.html', {'form': form}) | ||
29 | + | ||
30 | + user = User( | ||
31 | + username=form.cleaned_data.get('username'), | ||
32 | + email=form.cleaned_data.get('email'), | ||
33 | + first_name=form.cleaned_data.get('first_name'), | ||
34 | + last_name=form.cleaned_data.get('last_name'), | ||
35 | + is_active=False, | ||
36 | + ) | ||
37 | + user.set_password(form.cleaned_data.get('password1')) | ||
38 | + user.save() | ||
39 | + | ||
40 | + profile = UserProfile( | ||
41 | + user=user, | ||
42 | + institution=form.cleaned_data.get('institution'), | ||
43 | + role=form.cleaned_data.get('role'), | ||
44 | + twitter=form.cleaned_data.get('twitter'), | ||
45 | + facebook=form.cleaned_data.get('facebook'), | ||
46 | + google_talk=form.cleaned_data.get('google_talk'), | ||
47 | + webpage=form.cleaned_data.get('webpage'), | ||
48 | + verification_hash=uuid.uuid4().get_hex(), | ||
49 | + ) | ||
50 | + profile.save() | ||
51 | + | ||
52 | + signup_.send_verification_email(request, user) | ||
53 | + | ||
54 | + mailing_lists = form.cleaned_data.get('lists') | ||
55 | + if mailing_lists: | ||
56 | + signup_.send_email_lists(user, mailing_lists) | ||
57 | + | ||
58 | + | ||
59 | + # Check if the user's email have been used previously | ||
60 | + # in the mainling lists to link the user to old messages | ||
61 | + email_addr, created = EmailAddress.objects.get_or_create(address=user.email) | ||
62 | + if created: | ||
63 | + email_addr.real_name = user.get_full_name() | ||
64 | + | ||
65 | + email_addr.user = user | ||
66 | + email_addr.save() | ||
67 | + | ||
68 | + template_data = { | ||
69 | + 'msg': _((u'Registration completed successfully. Please visit your ' | ||
70 | + u'email address to validate it.')), | ||
71 | + 'msg_css_class': 'success', | ||
72 | + } | ||
73 | + | ||
74 | + return render(request, 'accounts/account_message.html', template_data) | ||
75 | + | ||
76 | + | ||
77 | +def verify_email(request, hash): | ||
78 | + """Verify hash and activate user's account""" | ||
79 | + | ||
80 | + profile = get_object_or_404(UserProfile, verification_hash=hash) | ||
81 | + | ||
82 | + profile.verification_hash = 'verified' | ||
83 | + profile.save() | ||
84 | + | ||
85 | + profile.user.is_active = True | ||
86 | + profile.user.save() | ||
87 | + | ||
88 | + template_data = { | ||
89 | + 'msg': _(u'E-mail validated correctly.'), | ||
90 | + 'msg_css_class': 'success', | ||
91 | + } | ||
92 | + | ||
93 | + return render(request, 'accounts/account_message.html', template_data) |
src/colab/custom_settings.py
@@ -49,11 +49,17 @@ LOGGING = { | @@ -49,11 +49,17 @@ LOGGING = { | ||
49 | 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s', | 49 | 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s', |
50 | }, | 50 | }, |
51 | }, | 51 | }, |
52 | + 'filters': { | ||
53 | + 'require_debug_false': { | ||
54 | + '()': 'django.utils.log.RequireDebugFalse' | ||
55 | + } | ||
56 | + }, | ||
52 | 'handlers': { | 57 | 'handlers': { |
53 | 'mail_admins': { | 58 | 'mail_admins': { |
54 | 'level': 'ERROR', | 59 | 'level': 'ERROR', |
55 | 'class': 'django.utils.log.AdminEmailHandler', | 60 | 'class': 'django.utils.log.AdminEmailHandler', |
56 | 'include_html': True, | 61 | 'include_html': True, |
62 | + 'filters': ['require_debug_false'], | ||
57 | }, | 63 | }, |
58 | 'sentry': { | 64 | 'sentry': { |
59 | 'level': 'ERROR', | 65 | 'level': 'ERROR', |
@@ -96,16 +102,6 @@ LOGGING = { | @@ -96,16 +102,6 @@ LOGGING = { | ||
96 | SERVER_EMAIL = '"Colab Interlegis" <noreply@interlegis.leg.br>' | 102 | SERVER_EMAIL = '"Colab Interlegis" <noreply@interlegis.leg.br>' |
97 | EMAIL_HOST_USER = SERVER_EMAIL | 103 | EMAIL_HOST_USER = SERVER_EMAIL |
98 | 104 | ||
99 | -#SOLR_HOSTNAME = 'solr.interlegis.leg.br' | ||
100 | -SOLR_HOSTNAME = '10.1.2.154' | ||
101 | -SOLR_PORT = '8080' | ||
102 | -SOLR_SELECT_PATH = '/solr/select' | ||
103 | - | ||
104 | -SOLR_COLAB_URI = 'http://colab.interlegis.leg.br' | ||
105 | -SOLR_BASE_QUERY = """ | ||
106 | - ((Type:changeset OR Type:ticket OR Type:wiki OR Type:thread) AND Title:["" TO *]) | ||
107 | -""" | ||
108 | - | ||
109 | TEMPLATE_CONTEXT_PROCESSORS = ( | 105 | TEMPLATE_CONTEXT_PROCESSORS = ( |
110 | 'django.contrib.auth.context_processors.auth', | 106 | 'django.contrib.auth.context_processors.auth', |
111 | 'django.core.context_processors.debug', | 107 | 'django.core.context_processors.debug', |
@@ -140,14 +136,40 @@ STATICFILES_DIRS = ( | @@ -140,14 +136,40 @@ STATICFILES_DIRS = ( | ||
140 | 136 | ||
141 | STATIC_ROOT = os.path.join(BASE_DIR, '..', 'www', 'static') | 137 | STATIC_ROOT = os.path.join(BASE_DIR, '..', 'www', 'static') |
142 | 138 | ||
139 | + | ||
140 | +### Proxy configuration | ||
143 | SOCKS_SERVER = None | 141 | SOCKS_SERVER = None |
144 | SOCKS_PORT = None | 142 | SOCKS_PORT = None |
145 | 143 | ||
144 | + | ||
145 | +### Feedzilla (planet) | ||
146 | from feedzilla.settings import * | 146 | from feedzilla.settings import * |
147 | FEEDZILLA_PAGE_SIZE = 5 | 147 | FEEDZILLA_PAGE_SIZE = 5 |
148 | FEEDZILLA_SITE_TITLE = gettext(u'Planet Colab') | 148 | FEEDZILLA_SITE_TITLE = gettext(u'Planet Colab') |
149 | FEEDZILLA_SITE_DESCRIPTION = gettext(u'Colab blog aggregator') | 149 | FEEDZILLA_SITE_DESCRIPTION = gettext(u'Colab blog aggregator') |
150 | 150 | ||
151 | + | ||
152 | +### BrowserID / Persona | ||
153 | +SITE_URL = 'http://colab.interlegis.leg.br' | ||
154 | + | ||
155 | +LOGIN_REDIRECT_URL = '/' | ||
156 | +LOGIN_REDIRECT_URL_FAILURE = '/' | ||
157 | +LOGOUT_REDIRECT_URL = '/' | ||
158 | +BROWSERID_CREATE_USER = False | ||
159 | + | ||
160 | + | ||
161 | +### Apache Solr | ||
162 | +#SOLR_HOSTNAME = 'solr.interlegis.leg.br' | ||
163 | +SOLR_HOSTNAME = '10.1.2.154' | ||
164 | +SOLR_PORT = '8080' | ||
165 | +SOLR_SELECT_PATH = '/solr/select' | ||
166 | + | ||
167 | +SOLR_COLAB_URI = 'http://colab.interlegis.leg.br' | ||
168 | +SOLR_BASE_QUERY = """ | ||
169 | + ((Type:changeset OR Type:ticket OR Type:wiki OR Type:thread) AND Title:["" TO *]) | ||
170 | +""" | ||
171 | + | ||
172 | + | ||
151 | try: | 173 | try: |
152 | from local_settings import * | 174 | from local_settings import * |
153 | except ImportError: | 175 | except ImportError: |
src/colab/deprecated/locale/pt_BR/LC_MESSAGES/django.po
@@ -37,31 +37,15 @@ msgstr "Não encontrado. Continue procurando! :)" | @@ -37,31 +37,15 @@ msgstr "Não encontrado. Continue procurando! :)" | ||
37 | msgid "Ooopz... something went wrong!" | 37 | msgid "Ooopz... something went wrong!" |
38 | msgstr "Ooopz... algo saiu errado!" | 38 | msgstr "Ooopz... algo saiu errado!" |
39 | 39 | ||
40 | -#: templates/account_change_password.html:9 templates/signup-form.html:9 | 40 | +#: templates/signup-form.html:9 |
41 | msgid "Please correct the errors below and try again." | 41 | msgid "Please correct the errors below and try again." |
42 | msgstr "Por favor, corrija os erros abaixo e tente novamente." | 42 | msgstr "Por favor, corrija os erros abaixo e tente novamente." |
43 | 43 | ||
44 | -#: templates/account_change_password.html:20 | ||
45 | -msgid "Change password" | ||
46 | -msgstr "Alterar senha" | ||
47 | - | ||
48 | -#: templates/account_request_reset_password.html:5 templates/login.html:30 | ||
49 | -msgid "I forgot my password" | ||
50 | -msgstr "Esqueci minha senha" | ||
51 | - | ||
52 | -#: templates/account_request_reset_password.html:11 | ||
53 | -msgid "User" | ||
54 | -msgstr "Usuário" | ||
55 | - | ||
56 | -#: templates/account_request_reset_password.html:13 | ||
57 | -msgid "Send new password" | ||
58 | -msgstr "Enviar nova senha" | ||
59 | - | ||
60 | #: templates/base.html:71 templates/login.html:44 templates/signup-form.html:6 | 44 | #: templates/base.html:71 templates/login.html:44 templates/signup-form.html:6 |
61 | msgid "Sign up" | 45 | msgid "Sign up" |
62 | msgstr "Cadastre-se" | 46 | msgstr "Cadastre-se" |
63 | 47 | ||
64 | -#: templates/base.html:74 templates/login.html:17 | 48 | +#: templates/base.html:74 |
65 | msgid "Login" | 49 | msgid "Login" |
66 | msgstr "Login" | 50 | msgstr "Login" |
67 | 51 | ||
@@ -122,27 +106,6 @@ msgstr "O conteúdo deste site está publicado sob a licença" | @@ -122,27 +106,6 @@ msgstr "O conteúdo deste site está publicado sob a licença" | ||
122 | msgid "Creative Commons - attribution, non-commercial" | 106 | msgid "Creative Commons - attribution, non-commercial" |
123 | msgstr "Creative Commons - atribuição e não-comercial" | 107 | msgstr "Creative Commons - atribuição e não-comercial" |
124 | 108 | ||
125 | -#: templates/email_account-reset-password.html:3 | ||
126 | -#, python-format | ||
127 | -msgid "" | ||
128 | -"\n" | ||
129 | -" This email was sent to confirm the password change request \n" | ||
130 | -" to the user's <b>%(username)s</b> of Interlegis Colab. If you have not \n" | ||
131 | -" made the request, please ignore this message.\n" | ||
132 | -msgstr "" | ||
133 | -"\n" | ||
134 | -" Este email foi enviado para confirmar a solicitação de troca de senha \n" | ||
135 | -" para o usuário <b>%(username)s</b> do Colab Interlegis. Caso você não \n" | ||
136 | -" tenha realizado a solicitação por favor ignore esta mensagem.\n" | ||
137 | - | ||
138 | -#: templates/email_account-reset-password.html:12 | ||
139 | -msgid "" | ||
140 | -"\n" | ||
141 | -" To perform the password change visit the link below:\n" | ||
142 | -msgstr "" | ||
143 | -"\n" | ||
144 | -" Para realizar a troca de senha acesse o link abaixo:\n" | ||
145 | - | ||
146 | #: templates/email_signup-email-confirmation.html:3 | 109 | #: templates/email_signup-email-confirmation.html:3 |
147 | msgid "Welcome to the Colab!" | 110 | msgid "Welcome to the Colab!" |
148 | msgstr "Bem-vindo ao Colab!" | 111 | msgstr "Bem-vindo ao Colab!" |
@@ -202,23 +165,6 @@ msgstr "RSS - Últimas Discussões" | @@ -202,23 +165,6 @@ msgstr "RSS - Últimas Discussões" | ||
202 | msgid "View more discussions..." | 165 | msgid "View more discussions..." |
203 | msgstr "Ver mais discussões..." | 166 | msgstr "Ver mais discussões..." |
204 | 167 | ||
205 | -#: templates/login.html:36 | ||
206 | -msgid "Not already registered? Sign up!" | ||
207 | -msgstr "Não possui cadastro? Casdastre-se" | ||
208 | - | ||
209 | -#: templates/login.html:38 | ||
210 | -msgid "" | ||
211 | -"To access some features of Colab you must be registered. \n" | ||
212 | -" If you are not already registered systems in the community " | ||
213 | -"Interlegis \n" | ||
214 | -" click on the link below and get to work!\n" | ||
215 | -" " | ||
216 | -msgstr "" | ||
217 | -"Para acessar alguns dos recursos do Colab é necessário estar registrado. \n" | ||
218 | -"Caso você ainda não esteja cadastrado nos sistemas da comunidade " | ||
219 | -"Interlegis \n" | ||
220 | -"clique no link abaixo e comece a colaborar!" | ||
221 | - | ||
222 | #: templates/open-data.html:6 | 168 | #: templates/open-data.html:6 |
223 | msgid "OpenData - Communities Interlegis" | 169 | msgid "OpenData - Communities Interlegis" |
224 | msgstr "OpenData - Comunidades Interlegis" | 170 | msgstr "OpenData - Comunidades Interlegis" |
src/colab/deprecated/templates/account_change_password.html
@@ -1,24 +0,0 @@ | @@ -1,24 +0,0 @@ | ||
1 | -{% extends "base.html" %} | ||
2 | -{% load i18n %} | ||
3 | -{% load form_field %} | ||
4 | - | ||
5 | -{% block main-content %} | ||
6 | - | ||
7 | -{% if form.errors %} | ||
8 | - <div class="alert"> | ||
9 | - <b>{% trans "Please correct the errors below and try again." %}</b> | ||
10 | - </div> | ||
11 | -{% endif %} | ||
12 | - | ||
13 | -<form method="POST" action="."> | ||
14 | - {% csrf_token %} | ||
15 | - | ||
16 | - <fieldset class="span-24 box"> | ||
17 | - {% render_form_field form.old_password %} | ||
18 | - {% render_form_field form.new_password1 %} | ||
19 | - {% render_form_field form.new_password2 %} | ||
20 | - <input type="submit" value="{% trans 'Change password' %}"/> | ||
21 | - </fieldset> | ||
22 | - | ||
23 | -</form> | ||
24 | -{% endblock %} |
src/colab/deprecated/templates/account_message.html
src/colab/deprecated/templates/account_request_reset_password.html
@@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
1 | -{% extends "base.html" %} | ||
2 | -{% load i18n %} | ||
3 | - | ||
4 | -{% block main-content %} | ||
5 | -<h2>{% trans "I forgot my password" %}</h2> | ||
6 | - | ||
7 | -<form method="POST" action="{% url 'request_reset_password' %}"> | ||
8 | - {% csrf_token %} | ||
9 | - | ||
10 | - <fieldset class="span-24 center box"> | ||
11 | - <label>{% trans "User" %}:</label> | ||
12 | - <input name="username"/> | ||
13 | - <input type="submit" value="{% trans 'Send new password' %}"/> | ||
14 | - </fieldset> | ||
15 | - | ||
16 | -</form> | ||
17 | - | ||
18 | -{% endblock %} |
src/colab/deprecated/templates/email_account-reset-password.html
@@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
1 | -{% load i18n %} | ||
2 | - | ||
3 | -{% blocktrans %} | ||
4 | - This email was sent to confirm the password change request | ||
5 | - to the user's <b>{{ username }}</b> of Interlegis Colab. If you have not | ||
6 | - made the request, please ignore this message. | ||
7 | -{% endblocktrans %} | ||
8 | - | ||
9 | -<br/> | ||
10 | -<br/> | ||
11 | - | ||
12 | -{% blocktrans %} | ||
13 | - To perform the password change visit the link below: | ||
14 | -{% endblocktrans %} | ||
15 | -<br/> | ||
16 | - | ||
17 | -<a href="http://{{ server_name }}{% url 'reset_password' hash %}"> | ||
18 | - http://{{ server_name }}{% url 'reset_password' hash %} | ||
19 | -</a> |
src/colab/deprecated/templates/email_signup-email-confirmation.html
@@ -1,9 +0,0 @@ | @@ -1,9 +0,0 @@ | ||
1 | -{% load i18n %} | ||
2 | - | ||
3 | -{% trans "Welcome to the Colab!" %} | ||
4 | - | ||
5 | -{% trans "To activate your account, please confirm your mail's activation by accessing the following link:" %} | ||
6 | - | ||
7 | -<a href="http://{{ server_name }}{% url 'email_verification' hash %}"> | ||
8 | - http://{{ server_name }}{% url 'email_verification' hash %} | ||
9 | -</a> |
src/colab/deprecated/templates/signup-form.html
@@ -1,67 +0,0 @@ | @@ -1,67 +0,0 @@ | ||
1 | -{% extends "base.html" %} | ||
2 | -{% load form_field %} | ||
3 | -{% load i18n %} | ||
4 | -{% block main-content %} | ||
5 | - | ||
6 | -<h2>{% trans "Sign up" %}</h2> | ||
7 | - | ||
8 | -{% if form.errors %} | ||
9 | -<div class="alert"><b>{% trans "Please correct the errors below and try again." %}</b></div> | ||
10 | -{% endif %} | ||
11 | - | ||
12 | -<div class="avatar-placeholder box"> | ||
13 | - <label class="avatar-placeholder">{% trans "Avatar" %}</label > | ||
14 | - <div class="avatar-image avatar"> | ||
15 | - <img src="{{ STATIC_URL }}img/user.png" alt="user"/> | ||
16 | - </div> | ||
17 | - <p> | ||
18 | - {% trans "Add an avatar to your account using" %} <a href="http://gravatar.com/" target="_blank">Gravatar</a>. | ||
19 | - </p> | ||
20 | -</div> | ||
21 | - | ||
22 | - | ||
23 | -<p class="required span-24 last"> | ||
24 | - <label>{% trans "Required fields" %}</label> | ||
25 | -</p> | ||
26 | - | ||
27 | -<form class="span-24" id="signup" action="." method="post"> | ||
28 | - {% csrf_token %} | ||
29 | - | ||
30 | - <fieldset class="box span-11"> | ||
31 | - <legend>{% trans "Access Information" %}</legend> | ||
32 | - {% render_form_field form.username %} | ||
33 | - {% render_form_field form.password1 %} | ||
34 | - {% render_form_field form.password2 %} | ||
35 | - </fieldset> | ||
36 | - | ||
37 | - <fieldset class="box last"> | ||
38 | - <legend>{% trans "Professionals Information" %}</legend> | ||
39 | - {% render_form_field form.institution %} | ||
40 | - {% render_form_field form.role %} | ||
41 | - </fieldset> | ||
42 | - | ||
43 | - <fieldset class="box span-11"> | ||
44 | - <legend>{% trans "Personal Information" %}</legend> | ||
45 | - {% render_form_field form.first_name %} | ||
46 | - {% render_form_field form.last_name %} | ||
47 | - {% render_form_field form.email %} | ||
48 | - </fieldset> | ||
49 | - | ||
50 | - <fieldset class="box last"> | ||
51 | - <legend>{% trans "Others" %}</legend> | ||
52 | - {% render_form_field form.twitter %} | ||
53 | - {% render_form_field form.facebook %} | ||
54 | - {% render_form_field form.google_talk %} | ||
55 | - {% render_form_field form.webpage %} | ||
56 | - </fieldset> | ||
57 | - | ||
58 | - <fieldset class="box span-11"> | ||
59 | - <legend>{% trans "Subscribe to mail lists" %}</legend> | ||
60 | - {% render_form_field form.lists %} | ||
61 | - </fieldset> | ||
62 | - | ||
63 | - <div class="span-24"> | ||
64 | - <input class="right" type="submit" value="{% trans 'Register' %}"/> | ||
65 | - </div> | ||
66 | -</form> | ||
67 | -{% endblock %} |
src/colab/deprecated/templates/user-profile.html
@@ -1,116 +0,0 @@ | @@ -1,116 +0,0 @@ | ||
1 | -{% extends "base.html" %} | ||
2 | -{% load i18n %} | ||
3 | -{% load form_field %} | ||
4 | - | ||
5 | -{% block head_js %} | ||
6 | - {% include "pizza-chart.html" with chart_div="collabs" chart_width=390 chart_height=230 %} | ||
7 | -{% endblock %} | ||
8 | - | ||
9 | -{% block main-content %} | ||
10 | - {% if not user_profile %} | ||
11 | - <span class="notice span-24"> | ||
12 | - <b>{% trans "User not registered." %}</b> {% trans "Is that you?" %} | ||
13 | - <a href="{% url 'signup' %}">{% trans "Click here and sign up." %}</a> | ||
14 | - </span> | ||
15 | - | ||
16 | - {% else %} | ||
17 | - | ||
18 | - {% ifequal request.user.username user_profile.user.username %} | ||
19 | - <span class="success span-24"> | ||
20 | - {% trans "Hey, look at you! Do you want to " %} | ||
21 | - <a href="{% url 'user_profile_update' request.user %}">{% trans "update your profile" %}</a>? | ||
22 | - </span> | ||
23 | - {% endifequal %} | ||
24 | - | ||
25 | - {% endif %} | ||
26 | - | ||
27 | - <div id="user-profile"> | ||
28 | - <h2>{{ email_address.get_full_name }}</h2> | ||
29 | - | ||
30 | - <div class="span-4"> | ||
31 | - <img class="avatar" width="120px" heigth="120px" | ||
32 | - src="http://www.gravatar.com/avatar/{{ email_address.md5 }}?s=120&d=identicon" /> | ||
33 | - </div> | ||
34 | - | ||
35 | - <div class="span-20 last"> | ||
36 | - <div class="span-10"> | ||
37 | - <form action="{% url 'user_profile_update' request.user %}" method='post'> | ||
38 | - {% csrf_token %} | ||
39 | - | ||
40 | - <h3>{% trans "Personal Information" %}</h3> | ||
41 | - <ul id="user-info"> | ||
42 | - <li> | ||
43 | - {{ form.username.label_tag }}: {{ user_profile.user.username }} | ||
44 | - {% ifequal request.user.username user_profile.user.username %} | ||
45 | - (<a href="{% url 'change_password' %}">{% trans "change password" %}</a>) | ||
46 | - {% endifequal %} | ||
47 | - </li> | ||
48 | - <li> | ||
49 | - {% render_form_field form.institution user_profile.institution %} | ||
50 | - </li> | ||
51 | - <li> | ||
52 | - {% render_form_field form.role user_profile.role %} | ||
53 | - </li> | ||
54 | - </ul> | ||
55 | - | ||
56 | - <hr class="space" /> | ||
57 | - | ||
58 | - <h3>{% trans "Other informations" %}</h3> | ||
59 | - <ul> | ||
60 | - <li> | ||
61 | - {% render_form_field form.twitter user_profile.twitter %} | ||
62 | - </li> | ||
63 | - <li> | ||
64 | - {% render_form_field form.facebook user_profile.facebook %} | ||
65 | - </li> | ||
66 | - <li> | ||
67 | - {% render_form_field form.google_talk user_profile.google_talk %} | ||
68 | - </li> | ||
69 | - <li> | ||
70 | - {% render_form_field form.webpage user_profile.webpage %} | ||
71 | - </li> | ||
72 | - </ul> | ||
73 | - | ||
74 | - <hr class="space"/> | ||
75 | - {% if editable %} | ||
76 | - <span class="span-5"> | ||
77 | - <input class="right" type="submit" value="{% trans 'Save' %}"/> | ||
78 | - </span> | ||
79 | - {% endif %} | ||
80 | - </form> | ||
81 | - </div> | ||
82 | - | ||
83 | - {% if type_count %} | ||
84 | - <div class="span-10 last"> | ||
85 | - <h3 class="center">{% trans "Collaborations by Area" %}</h3> | ||
86 | - <div id="collabs"></div> | ||
87 | - </div> | ||
88 | - {% endif %} | ||
89 | - </div> | ||
90 | - | ||
91 | - <hr class="space" /> | ||
92 | - | ||
93 | - <div class="span-13"> | ||
94 | - <h3>{% trans "Latest posted" %} </h3> | ||
95 | - <ul class="colborder"> | ||
96 | - {% for doc in emails %} | ||
97 | - {% include "message-preview.html" %} | ||
98 | - {% empty %} | ||
99 | - <li>{% trans "There are no posts by this user so far." %}</li> | ||
100 | - {% endfor %} | ||
101 | - </ul> | ||
102 | - </div> | ||
103 | - | ||
104 | - <div class="span-11 last"> | ||
105 | - <h3>{% trans "Community inside participations" %}</h3> | ||
106 | - <ul> | ||
107 | - {% for doc in docs %} | ||
108 | - {% include "message-preview.html" %} | ||
109 | - {% empty %} | ||
110 | - <li>{% trans "No contributions of this user so far." %}</li> | ||
111 | - {% endfor %} | ||
112 | - </ul> | ||
113 | - </div> | ||
114 | - | ||
115 | - </div> | ||
116 | -{% endblock %} |
src/colab/deprecated/views/signup.py
@@ -1,223 +0,0 @@ | @@ -1,223 +0,0 @@ | ||
1 | -#!/usr/bin/env python | ||
2 | -# encoding: utf-8 | ||
3 | -""" | ||
4 | -signup.py | ||
5 | - | ||
6 | -Created by Sergio Campos on 2012-01-10. | ||
7 | -""" | ||
8 | - | ||
9 | -import uuid | ||
10 | -from colab.deprecated import signup as signup_ | ||
11 | - | ||
12 | -from django.template import RequestContext | ||
13 | -from django.contrib.auth.models import User | ||
14 | -from django.utils.translation import ugettext as _ | ||
15 | -from django.contrib.auth.decorators import login_required | ||
16 | -from django.contrib.auth.forms import SetPasswordForm, PasswordChangeForm | ||
17 | -from django.shortcuts import render_to_response, redirect, get_object_or_404 | ||
18 | - | ||
19 | -from super_archives.forms import UserCreationForm | ||
20 | -from super_archives.models import UserProfile, EmailAddress | ||
21 | - | ||
22 | - | ||
23 | -def signup(request): | ||
24 | - | ||
25 | - # If the request method is GET just return the form | ||
26 | - if request.method == 'GET': | ||
27 | - form = UserCreationForm() | ||
28 | - return render_to_response('signup-form.html', {'form': form}, | ||
29 | - RequestContext(request)) | ||
30 | - | ||
31 | - # If the request method is POST try to store data | ||
32 | - form = UserCreationForm(request.POST) | ||
33 | - | ||
34 | - # If there is validation errors give the form back to the user | ||
35 | - if not form.is_valid(): | ||
36 | - return render_to_response('signup-form.html', {'form': form}, | ||
37 | - RequestContext(request)) | ||
38 | - | ||
39 | - user = User( | ||
40 | - username=form.cleaned_data.get('username'), | ||
41 | - email=form.cleaned_data.get('email'), | ||
42 | - first_name=form.cleaned_data.get('first_name'), | ||
43 | - last_name=form.cleaned_data.get('last_name'), | ||
44 | - is_active=False, | ||
45 | - ) | ||
46 | - user.set_password(form.cleaned_data.get('password1')) | ||
47 | - user.save() | ||
48 | - | ||
49 | - profile = UserProfile( | ||
50 | - user=user, | ||
51 | - institution=form.cleaned_data.get('institution'), | ||
52 | - role=form.cleaned_data.get('role'), | ||
53 | - twitter=form.cleaned_data.get('twitter'), | ||
54 | - facebook=form.cleaned_data.get('facebook'), | ||
55 | - google_talk=form.cleaned_data.get('google_talk'), | ||
56 | - webpage=form.cleaned_data.get('webpage'), | ||
57 | - verification_hash=uuid.uuid4().get_hex(), | ||
58 | - ) | ||
59 | - profile.save() | ||
60 | - | ||
61 | - signup_.send_verification_email(request, user) | ||
62 | - | ||
63 | - mailing_lists = form.cleaned_data.get('lists') | ||
64 | - if mailing_lists: | ||
65 | - signup_.send_email_lists(user, mailing_lists) | ||
66 | - | ||
67 | - | ||
68 | - # Check if the user's email have been used previously | ||
69 | - # in the mainling lists to link the user to old messages | ||
70 | - email_addr, created = EmailAddress.objects.get_or_create(address=user.email) | ||
71 | - if created: | ||
72 | - email_addr.real_name = user.get_full_name() | ||
73 | - | ||
74 | - email_addr.user = user | ||
75 | - email_addr.save() | ||
76 | - | ||
77 | - template_data = { | ||
78 | - 'msg': _((u'Registration completed successfully. Please visit your ' | ||
79 | - u'email address to validate it.')), | ||
80 | - 'msg_css_class': 'success', | ||
81 | - } | ||
82 | - | ||
83 | - return render_to_response('account_message.html', template_data, | ||
84 | - RequestContext(request)) | ||
85 | - | ||
86 | - | ||
87 | -def verify_email(request, hash): | ||
88 | - """Verify hash and activate user's account""" | ||
89 | - | ||
90 | - profile = get_object_or_404(UserProfile, verification_hash=hash) | ||
91 | - | ||
92 | - profile.verification_hash = 'verified' | ||
93 | - profile.save() | ||
94 | - | ||
95 | - profile.user.is_active = True | ||
96 | - profile.user.save() | ||
97 | - | ||
98 | - template_data = { | ||
99 | - 'msg': _(u'E-mail validated correctly.'), | ||
100 | - 'msg_css_class': 'success', | ||
101 | - } | ||
102 | - | ||
103 | - return render_to_response('account_message.html', template_data, | ||
104 | - RequestContext(request)) | ||
105 | - | ||
106 | - | ||
107 | -def request_reset_password(request): | ||
108 | - """Request a password reset. | ||
109 | - | ||
110 | - In case request method is GET it will display the password reset | ||
111 | - form. Otherwise we'll look for a username in the POST request to | ||
112 | - have its password reset. This user will receive a link where he | ||
113 | - will be allowed to change his password. | ||
114 | - | ||
115 | - """ | ||
116 | - | ||
117 | - if request.method == 'GET': | ||
118 | - return render_to_response('account_request_reset_password.html', {}, | ||
119 | - RequestContext(request)) | ||
120 | - | ||
121 | - username = request.POST.get('username') | ||
122 | - | ||
123 | - try: | ||
124 | - user = User.objects.get(username=username) | ||
125 | - except User.DoesNotExist: | ||
126 | - user = None | ||
127 | - | ||
128 | - if user and user.is_active: | ||
129 | - profile = user.profile | ||
130 | - profile.verification_hash = uuid.uuid4().get_hex() | ||
131 | - profile.save() | ||
132 | - | ||
133 | - signup_.send_reset_password_email(request, user) | ||
134 | - | ||
135 | - msg = _((u'For your safety, in a few moments you will receive ' | ||
136 | - u'an email asking you to confirm the password ' | ||
137 | - u'change request. Please wait.')) | ||
138 | - | ||
139 | - template_data = { | ||
140 | - 'msg': msg, | ||
141 | - 'msg_css_class': 'info', | ||
142 | - } | ||
143 | - | ||
144 | - return render_to_response('account_message.html', template_data, | ||
145 | - RequestContext(request)) | ||
146 | - | ||
147 | - | ||
148 | -def reset_password(request, hash): | ||
149 | - """Perform a password change. | ||
150 | - | ||
151 | - If the request method is set to GET and the hash matches a form | ||
152 | - will be displayed to the user allowing the password change. | ||
153 | - If the request method is POST the user password will be changed | ||
154 | - to the newly set data. | ||
155 | - | ||
156 | - """ | ||
157 | - | ||
158 | - profile = get_object_or_404(UserProfile, verification_hash=hash) | ||
159 | - user = profile.user | ||
160 | - | ||
161 | - form = SetPasswordForm(profile.user) | ||
162 | - | ||
163 | - template_data = { | ||
164 | - 'form': form, | ||
165 | - 'hash': hash, | ||
166 | - } | ||
167 | - | ||
168 | - if request.method == 'GET': | ||
169 | - return render_to_response('account_change_password.html', | ||
170 | - template_data, RequestContext(request)) | ||
171 | - | ||
172 | - | ||
173 | - form = SetPasswordForm(user, request.POST) | ||
174 | - template_data.update({'form': form}) | ||
175 | - | ||
176 | - if not form.is_valid(): | ||
177 | - return render_to_response('account_change_password.html', | ||
178 | - template_data, RequestContext(request)) | ||
179 | - | ||
180 | - profile.verification_hash = 'verified' | ||
181 | - profile.save() | ||
182 | - | ||
183 | - user.set_password(form.cleaned_data.get('new_password1')) | ||
184 | - user.save() | ||
185 | - | ||
186 | - template_data.update({ | ||
187 | - 'msg': _(u'Password changed successfully!'), | ||
188 | - 'msg_css_class': 'success', | ||
189 | - }) | ||
190 | - return render_to_response('account_message.html', template_data, | ||
191 | - RequestContext(request)) | ||
192 | - | ||
193 | -@login_required | ||
194 | -def change_password(request): | ||
195 | - """Change a password for an authenticated user.""" | ||
196 | - | ||
197 | - form = PasswordChangeForm(request.user) | ||
198 | - | ||
199 | - template_data = { | ||
200 | - 'form': form | ||
201 | - } | ||
202 | - | ||
203 | - if request.method == 'GET': | ||
204 | - return render_to_response('account_change_password.html', | ||
205 | - template_data, RequestContext(request)) | ||
206 | - | ||
207 | - form = PasswordChangeForm(request.user, request.POST) | ||
208 | - template_data.update({'form': form}) | ||
209 | - | ||
210 | - if not form.is_valid(): | ||
211 | - return render_to_response('account_change_password.html', | ||
212 | - template_data, RequestContext(request)) | ||
213 | - | ||
214 | - request.user.set_password(form.cleaned_data.get('new_password1')) | ||
215 | - request.user.save() | ||
216 | - | ||
217 | - template_data.update({ | ||
218 | - 'msg': _(u'Password changed successfully!'), | ||
219 | - 'msg_css_class': 'success', | ||
220 | - }) | ||
221 | - return render_to_response('account_message.html', template_data, | ||
222 | - RequestContext(request)) | ||
223 | - |
src/colab/deprecated/views/userprofile.py
@@ -10,55 +10,55 @@ from django.template import RequestContext | @@ -10,55 +10,55 @@ from django.template import RequestContext | ||
10 | from django.contrib.auth.models import User | 10 | from django.contrib.auth.models import User |
11 | from django.forms.models import model_to_dict | 11 | from django.forms.models import model_to_dict |
12 | from django.contrib.auth.decorators import login_required | 12 | from django.contrib.auth.decorators import login_required |
13 | -from django.shortcuts import render_to_response, get_object_or_404, redirect | 13 | +from django.shortcuts import render, get_object_or_404, redirect |
14 | 14 | ||
15 | from colab.deprecated import solrutils | 15 | from colab.deprecated import solrutils |
16 | from super_archives.forms import UserCreationForm, UserUpdateForm | 16 | from super_archives.forms import UserCreationForm, UserUpdateForm |
17 | from super_archives.models import Message, UserProfile, EmailAddress | 17 | from super_archives.models import Message, UserProfile, EmailAddress |
18 | - | 18 | + |
19 | 19 | ||
20 | def read(request, user, email_address=None, editable=False, form=None): | 20 | def read(request, user, email_address=None, editable=False, form=None): |
21 | - | 21 | + |
22 | if form is None: | 22 | if form is None: |
23 | form = UserCreationForm() | 23 | form = UserCreationForm() |
24 | - | 24 | + |
25 | if user: | 25 | if user: |
26 | email_addresses = user.emails.all() | 26 | email_addresses = user.emails.all() |
27 | profile = user.profile | 27 | profile = user.profile |
28 | last_modified_docs = solrutils.get_latest_collaborations( | 28 | last_modified_docs = solrutils.get_latest_collaborations( |
29 | username=user.username | 29 | username=user.username |
30 | ) | 30 | ) |
31 | - | 31 | + |
32 | type_count = solrutils.count_types( | 32 | type_count = solrutils.count_types( |
33 | filters={'collaborator': user.username} | 33 | filters={'collaborator': user.username} |
34 | ) | 34 | ) |
35 | - | 35 | + |
36 | else: | 36 | else: |
37 | email_addresses = [email_address] | 37 | email_addresses = [email_address] |
38 | profile = None | 38 | profile = None |
39 | last_modified_docs = [] | 39 | last_modified_docs = [] |
40 | type_count = {} | 40 | type_count = {} |
41 | - | 41 | + |
42 | if not email_address and email_addresses: | 42 | if not email_address and email_addresses: |
43 | email_address = email_addresses[0] | 43 | email_address = email_addresses[0] |
44 | 44 | ||
45 | email_addresses_ids = tuple([str(addr.id) for addr in email_addresses]) | 45 | email_addresses_ids = tuple([str(addr.id) for addr in email_addresses]) |
46 | - | 46 | + |
47 | query = """ | 47 | query = """ |
48 | - SELECT | ||
49 | - * | 48 | + SELECT |
49 | + * | ||
50 | FROM | 50 | FROM |
51 | super_archives_message JOIN ( | 51 | super_archives_message JOIN ( |
52 | SELECT id | 52 | SELECT id |
53 | FROM super_archives_message | 53 | FROM super_archives_message |
54 | WHERE from_address_id IN (%(ids)s) | 54 | WHERE from_address_id IN (%(ids)s) |
55 | GROUP BY thread_id, id | 55 | GROUP BY thread_id, id |
56 | - ) AS subquery | 56 | + ) AS subquery |
57 | ON subquery.id = super_archives_message.id | 57 | ON subquery.id = super_archives_message.id |
58 | - ORDER BY | 58 | + ORDER BY |
59 | received_time DESC | 59 | received_time DESC |
60 | LIMIT 10; | 60 | LIMIT 10; |
61 | - | 61 | + |
62 | """ % {'ids': ','.join(email_addresses_ids)} | 62 | """ % {'ids': ','.join(email_addresses_ids)} |
63 | 63 | ||
64 | emails = Message.objects.raw(query) | 64 | emails = Message.objects.raw(query) |
@@ -73,9 +73,8 @@ def read(request, user, email_address=None, editable=False, form=None): | @@ -73,9 +73,8 @@ def read(request, user, email_address=None, editable=False, form=None): | ||
73 | 'type_count': type_count, | 73 | 'type_count': type_count, |
74 | 'docs': last_modified_docs, | 74 | 'docs': last_modified_docs, |
75 | } | 75 | } |
76 | - | ||
77 | - return render_to_response('user-profile.html', template_data, | ||
78 | - RequestContext(request)) | 76 | + |
77 | + return render(request, 'accounts/user-profile.html', template_data) | ||
79 | 78 | ||
80 | 79 | ||
81 | @login_required | 80 | @login_required |
@@ -97,7 +96,7 @@ def by_emailhash(request, emailhash): | @@ -97,7 +96,7 @@ def by_emailhash(request, emailhash): | ||
97 | def update(request, username): | 96 | def update(request, username): |
98 | profile = get_object_or_404(UserProfile, user__username=username) | 97 | profile = get_object_or_404(UserProfile, user__username=username) |
99 | form = UserUpdateForm(initial=model_to_dict(profile)) | 98 | form = UserUpdateForm(initial=model_to_dict(profile)) |
100 | - | 99 | + |
101 | if request.method == "GET": | 100 | if request.method == "GET": |
102 | return read(request, profile.user, editable=True, form=form) | 101 | return read(request, profile.user, editable=True, form=form) |
103 | 102 | ||
@@ -112,5 +111,5 @@ def update(request, username): | @@ -112,5 +111,5 @@ def update(request, username): | ||
112 | profile.google_talk = form.cleaned_data.get('google_talk') | 111 | profile.google_talk = form.cleaned_data.get('google_talk') |
113 | profile.webpage = form.cleaned_data.get('webpage') | 112 | profile.webpage = form.cleaned_data.get('webpage') |
114 | profile.save() | 113 | profile.save() |
115 | - | 114 | + |
116 | return redirect('user_profile', profile.user.username) | 115 | return redirect('user_profile', profile.user.username) |
src/colab/local_settings-dev.py
@@ -21,12 +21,3 @@ SECRET_KEY = ')(jksdfhsjkadfhjkh234ns!8fqu-1186h$vuj' | @@ -21,12 +21,3 @@ SECRET_KEY = ')(jksdfhsjkadfhjkh234ns!8fqu-1186h$vuj' | ||
21 | #SOCKS_PORT = 9050 | 21 | #SOCKS_PORT = 9050 |
22 | 22 | ||
23 | SITE_URL = 'http://localhost:8000' | 23 | SITE_URL = 'http://localhost:8000' |
24 | - | ||
25 | -# Path to redirect to on successful login. | ||
26 | -LOGIN_REDIRECT_URL = '/' | ||
27 | - | ||
28 | -# Path to redirect to on unsuccessful login attempt. | ||
29 | -LOGIN_REDIRECT_URL_FAILURE = '/' | ||
30 | - | ||
31 | -# Path to redirect to on logout. | ||
32 | -LOGOUT_REDIRECT_URL = '/' |
src/colab/urls.py
1 | from django.conf.urls import patterns, include, url | 1 | from django.conf.urls import patterns, include, url |
2 | from django.views.generic import TemplateView | 2 | from django.views.generic import TemplateView |
3 | - | ||
4 | -# Uncomment the next two lines to enable the admin: | ||
5 | from django.contrib import admin | 3 | from django.contrib import admin |
4 | + | ||
6 | admin.autodiscover() | 5 | admin.autodiscover() |
7 | 6 | ||
8 | urlpatterns = patterns('', | 7 | urlpatterns = patterns('', |
9 | url(r'^$', 'colab.deprecated.views.other.home', name='home'), | 8 | url(r'^$', 'colab.deprecated.views.other.home', name='home'), |
10 | - | ||
11 | - url(r'^archives/', include('super_archives.urls')), | ||
12 | - | ||
13 | - url(r'^api/', include('api.urls')), | ||
14 | 9 | ||
15 | - url(r'^rss/', include('rss.urls')), | 10 | + url(r'^search/$', 'colab.deprecated.views.other.search', name='search'), |
16 | 11 | ||
17 | url(r'open-data/$', TemplateView.as_view(template_name='open-data.html'), | 12 | url(r'open-data/$', TemplateView.as_view(template_name='open-data.html'), |
18 | name='opendata'), | 13 | name='opendata'), |
19 | 14 | ||
20 | - url(r'^user/(?P<username>[\w@+.-]+)/?$', | ||
21 | - 'colab.deprecated.views.userprofile.by_username', name='user_profile'), | ||
22 | - | ||
23 | - url(r'^user/$', 'colab.deprecated.views.userprofile.by_request_user', | ||
24 | - name='user_profile_by_request_user'), | 15 | + url(r'^archives/', include('super_archives.urls')), |
25 | 16 | ||
26 | - url(r'^user/hash/(?P<emailhash>[\w]+)$', | ||
27 | - 'colab.deprecated.views.userprofile.by_emailhash'), | 17 | + url(r'^api/', include('api.urls')), |
28 | 18 | ||
29 | - url(r'^user/(?P<username>[\w@+.-]+)/edit/?$', | ||
30 | - 'colab.deprecated.views.userprofile.update', name='user_profile_update'), | ||
31 | - | ||
32 | - url(r'^search/$', 'colab.deprecated.views.other.search', name='search'), | ||
33 | - | ||
34 | - url(r'^account/$', 'colab.deprecated.views.signup.signup', name='signup'), | ||
35 | - | ||
36 | - url(r'^account/changepassword/$', 'colab.deprecated.views.signup.change_password', | ||
37 | - name='change_password'), | ||
38 | - | ||
39 | - url(r'^account/resetpassword/$', | ||
40 | - 'colab.deprecated.views.signup.request_reset_password', | ||
41 | - name='request_reset_password'), | ||
42 | - | ||
43 | - url(r'^account/reset_password/(?P<hash>[\w]{32})/$', | ||
44 | - 'colab.deprecated.views.signup.reset_password', name='reset_password'), | ||
45 | - | ||
46 | - url(r'^signup/verify/(?P<hash>[\w]{32})/$', | ||
47 | - 'colab.deprecated.views.signup.verify_email', name='email_verification'), | ||
48 | - | ||
49 | - url(r'^account/login/$', 'django.contrib.auth.views.login', | ||
50 | - {'template_name': 'login.html'}, name='login'), | 19 | + url(r'^rss/', include('rss.urls')), |
51 | 20 | ||
52 | - url(r'^account/logout/$', 'django.contrib.auth.views.logout', | ||
53 | - {'next_page': '/'}, name='logout'), | 21 | + url(r'^user/', include('accounts.urls')), # Kept for backwards compatibility |
22 | + url(r'^signup/', include('accounts.urls')), # (same here) TODO: move to nginx | ||
23 | + url(r'^account/', include('accounts.urls')), | ||
54 | 24 | ||
55 | url(r'^planet/', include('feedzilla.urls')), | 25 | url(r'^planet/', include('feedzilla.urls')), |
56 | 26 | ||
@@ -59,4 +29,3 @@ urlpatterns = patterns('', | @@ -59,4 +29,3 @@ urlpatterns = patterns('', | ||
59 | # Uncomment the next line to enable the admin: | 29 | # Uncomment the next line to enable the admin: |
60 | url(r'^colab/admin/', include(admin.site.urls)), | 30 | url(r'^colab/admin/', include(admin.site.urls)), |
61 | ) | 31 | ) |
62 | - |