# HG changeset patch # User veltr # Date 1358439711 -3600 # Node ID b1b624f81f226a90297f71d04901d1ad03b5c0cf # Parent f1b68efb360a7c8b58e70c03c6ae9fb2f0feb828# Parent d63d616116a0678a22bdd343f9c2a94105865354 Merge with d63d616116a0678a22bdd343f9c2a94105865354 diff -r f1b68efb360a -r b1b624f81f22 .hgtags --- a/.hgtags Thu Jan 17 17:20:23 2013 +0100 +++ b/.hgtags Thu Jan 17 17:21:51 2013 +0100 @@ -8,3 +8,4 @@ 783daa58e7a27a9151c0e225beaee0a2e04c0c76 V00.06 d081fc4250c299647db44e2963426dd36e293f89 V00.07 0e1105a35754d3981826d7683ab17e5fc0411cc0 V00.08 +ebaf7878c756ff54575e7380649e3496c1c1c754 V00.09 diff -r f1b68efb360a -r b1b624f81f22 src/hashcut/__init__.py --- a/src/hashcut/__init__.py Thu Jan 17 17:20:23 2013 +0100 +++ b/src/hashcut/__init__.py Thu Jan 17 17:21:51 2013 +0100 @@ -1,4 +1,4 @@ -VERSION = (0, 8, 0, "final", 0) +VERSION = (0, 9, 0, "final", 0) def get_version(): diff -r f1b68efb360a -r b1b624f81f22 src/hashcut/static/hashcut/bpi/css/common.css --- a/src/hashcut/static/hashcut/bpi/css/common.css Thu Jan 17 17:20:23 2013 +0100 +++ b/src/hashcut/static/hashcut/bpi/css/common.css Thu Jan 17 17:21:51 2013 +0100 @@ -340,7 +340,7 @@ } /* popin - user - signup */ -.signup-button{ +.signup-button, .logout-button{ background-color: #de2500; } .user .popin-content{ diff -r f1b68efb360a -r b1b624f81f22 src/hashcut/static/hashcut/iri/css/common.css --- a/src/hashcut/static/hashcut/iri/css/common.css Thu Jan 17 17:20:23 2013 +0100 +++ b/src/hashcut/static/hashcut/iri/css/common.css Thu Jan 17 17:21:51 2013 +0100 @@ -340,7 +340,7 @@ } /* popin - user - signup */ -.signup-button{ +.signup-button, .logout-button{ background-color: #de2500; } .user .popin-content{ diff -r f1b68efb360a -r b1b624f81f22 src/hashcut/templates/partial/mashup_popin_user.html --- a/src/hashcut/templates/partial/mashup_popin_user.html Thu Jan 17 17:20:23 2013 +0100 +++ b/src/hashcut/templates/partial/mashup_popin_user.html Thu Jan 17 17:21:51 2013 +0100 @@ -12,6 +12,9 @@

{% trans 'Switch account' %}

+

+ {% trans 'Log out' %} +

{% endif %}
diff -r f1b68efb360a -r b1b624f81f22 src/hashcut/urls.py --- a/src/hashcut/urls.py Thu Jan 17 17:20:23 2013 +0100 +++ b/src/hashcut/urls.py Thu Jan 17 17:21:51 2013 +0100 @@ -1,6 +1,6 @@ from django.conf.urls.defaults import patterns, url from hashcut.views import MashupHome, MashupEdit, MashupHashcut, MashupContent, MashupProfile, MashupAllMashups,\ - MashupAllContents, MashupCreateUser, MashupIdenticateUser + MashupAllContents, MashupCreateUser, MashupIdenticateUser, MashupLogOut urlpatterns = patterns('', url(r'^jsi18n/(?P\S+?)/$', 'django.views.i18n.javascript_catalog', name='jsi18n'), @@ -13,6 +13,7 @@ url(r'^(?P.*)/allcontents/$', MashupAllContents.as_view(), name="mashup_all_contents"), url(r'^(?P.*)/createuser/$', MashupCreateUser.as_view(), name="mashup_create_user"), url(r'^(?P.*)/iduser/$', MashupIdenticateUser.as_view(), name="mashup_identicate_user"), + url(r'^(?P.*)/logout/$', MashupLogOut.as_view(), name="mashup_logout"), url(r'^(?P.*)/$', MashupHome.as_view(), name="mashup_home"), url(r'^$', MashupHome.as_view()), ) diff -r f1b68efb360a -r b1b624f81f22 src/hashcut/views.py --- a/src/hashcut/views.py Thu Jan 17 17:20:23 2013 +0100 +++ b/src/hashcut/views.py Thu Jan 17 17:21:51 2013 +0100 @@ -1,16 +1,17 @@ from django.conf import settings -from django.contrib.auth import authenticate, login +from django.contrib.auth import authenticate, login, logout +from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.http import HttpResponseNotFound, HttpResponse +from django.shortcuts import redirect from django.views.generic.base import View, TemplateResponseMixin +from hashcut.models import Mashup, Branding from ldt.api.ldt.resources import ProjectResource from ldt.ldt_utils.models import Project, Content from ldt.security.cache import cached_assign import logging -from hashcut.models import Mashup, Branding -from django.contrib.auth.models import User -from django.shortcuts import redirect +import re class MashupContextView(View): @@ -222,6 +223,8 @@ u_email = request.POST["signup-email"] u_pwd1 = request.POST["signup-password"] u_pwd2 = request.POST["signup-confirm-password"] + if not re.match(r'^[a-zA-Z0-9]*$', u_username): + return HttpResponse("Username not valid : only letters a-z A-Z and numbers.") if u_pwd1 == "" or u_pwd1 != u_pwd2: return HttpResponse("Password don't match.") u = None @@ -265,5 +268,14 @@ return HttpResponse("Problem in authentication. User and password don't match.") return redirect('mashup_home', branding=branding) + + +class MashupLogOut(MashupHome): + + def get(self, request, branding="iri", **kwargs): + logout(request) + return redirect('mashup_home', branding=branding) + + \ No newline at end of file