notificacao do usuário quando o login estiver incorreto e melhorando umas mensagens...
authorLincoln de Sousa <lincoln@archlinux-br.org>
Thu, 20 Sep 2007 10:40:44 +0000 (07:40 -0300)
committerLincoln de Sousa <lincoln@archlinux-br.org>
Thu, 20 Sep 2007 10:40:44 +0000 (07:40 -0300)
decorators.py
views.py

index 079a484..6918158 100644 (file)
@@ -17,7 +17,10 @@ License along with this program; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
 
+    Changes:
+
     * Lincoln de Sousa (22 Jul 2007) adding is_login_form here.
+
 """
 from django.contrib.auth.forms import AuthenticationForm
 from django.contrib.auth import login
@@ -40,10 +43,9 @@ def enable_login_form(func):
                     request.session.delete_test_cookie()
                 except KeyError:
                     pass
+                return HttpResponseRedirect('/')
             else:
-                # TODO: Notify the user that data sent is wrong.
-                msg = _('User name and Password doesn\'t match')
-                request.error_message = msg
+                return HttpResponseRedirect('/?login_failed')
 
         request.session.set_test_cookie()
         return func(request, *args, **kwargs)
index bf5db99..0ba1092 100644 (file)
--- a/views.py
+++ b/views.py
@@ -51,8 +51,10 @@ def build_response(request, template, extra={}):
     news = Noticia.objects.order_by('-data_criacao')
     menus = Menu.objects.all()
     index_sections = Secao.objects.filter(index=True)
+    login_failed = 'login_failed' in request.GET
     c = {'news': news, 'menu': menus,
-        'index_sections': index_sections}
+        'index_sections': index_sections,
+        'login_failed': login_failed}
     c.update(extra)
     return render_to_response(template, Context(c),
             context_instance=RequestContext(request))
@@ -74,8 +76,8 @@ def cadastro_palestrante(request):
         wrong = False
 
         if not cd['telefone'] and not cd['celular']:
-            badattr['telefone_comercial'] = ['Algum número de telefone '
-                                             'precisa ser informado']
+            badattr['telefone_comercial'] = \
+                    ['Algum número de telefone precisa ser informado']
             wrong = True
 
         # don't save duplicated users...
@@ -133,7 +135,8 @@ def cadastro_palestrante(request):
                     t.render(c), FROM_EMAIL, [email])
                 m.send()
             except Exception:
-                badattr['email'] = ['Não pude enviar o email de confirmação']
+                badattr['email'] = \
+                    ['Desculpe mas não pude enviar o email de confirmação']
                 transaction.rollback()
             else:
                 ok = True