savannah-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 2


From: Jonathan Gonzalez V.
Subject: [Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 2fae2b8c59400360a10d74fe190ca5b63a4304f3
Date: Wed, 24 Jun 2009 19:09:45 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Savane-cleanup framework".

The branch, master has been updated
       via  2fae2b8c59400360a10d74fe190ca5b63a4304f3 (commit)
       via  335f53477fa95a68078e26dbcedb57f74b2f1259 (commit)
      from  6a3773599bba85cb9f2e4e44a570678173fcb4cd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=2fae2b8c59400360a10d74fe190ca5b63a4304f3

commit 2fae2b8c59400360a10d74fe190ca5b63a4304f3
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Wed Jun 24 15:05:38 2009 -0400

    Added login_required to all the views that need it

diff --git a/savane/savane_user/views.py b/savane/savane_user/views.py
index fe295ef..5adc0f0 100644
--- a/savane/savane_user/views.py
+++ b/savane/savane_user/views.py
@@ -1,7 +1,8 @@
 from django.template import RequestContext
 from django.shortcuts import render_to_response
-from django.http import HttpResponse, HttpResponseRedirect
+from django.http import HttpResponseRedirect
 from django.contrib.auth import authenticate, login, logout
+from django.contrib.auth.decorators import login_required
 from django import forms
 from savane_user.models import User
 
@@ -10,27 +11,33 @@ def index( request ):
                                RequestContext( request,
                                                ) )
 def sv_login( request ):
-    username = request.POST['username']
-    password = request.POST['password']
 
-    user = authenticate( username=username, password=password )
+    if request.method == 'POST':
+        username = request.POST['username']
+        password = request.POST['password']
 
-    if user is not None:
-        login( request, user )
-    else:
-        login_error = u"User or password didn't match"
-        return render_to_response( 'error.html',
-                                   {'error' : login_error
-                                    } )
+        if username != '' and password != '':
+            user = authenticate( username=username, password=password )
+        else:
+            user = None
 
-    return HttpResponseRedirect ( '/' )
+        if user is not None:
+            login( request, user )
+        else:
+            login_error = u"User or password didn't match"
+            return render_to_response( 'error.html',
+                                       {'error' : login_error
+                                        } )
 
+    return HttpResponseRedirect ( '/user/' )
+
address@hidden()
 def sv_logout( request ):
     logout( request )
 
     return HttpResponseRedirect( '/' )
 
-
address@hidden()
 def sv_conf( request ):
 
     error_msg = ''
@@ -84,11 +91,12 @@ def sv_conf( request ):
                                                  }
                                                ) )
 
address@hidden()
 def sv_resume_skill( request ):
     return render_to_response( 'savane_user/resume_skill.html',
                                RequestContext( request,
                                                ) )
-
address@hidden()
 def sv_ssh_gpg( request ):
 
     error_msg = None

http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=335f53477fa95a68078e26dbcedb57f74b2f1259

commit 335f53477fa95a68078e26dbcedb57f74b2f1259
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Wed Jun 24 15:05:19 2009 -0400

    Added LOGIN_URL to use login_required

diff --git a/savane/settings.py b/savane/settings.py
index 467c12c..51e6876 100644
--- a/savane/settings.py
+++ b/savane/settings.py
@@ -88,6 +88,8 @@ AUTHENTICATION_BACKENDS = (
     'savane.savane_user.backend.SavaneAuthBackend',
 )
 
+LOGIN_URL = '/user/'
+
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',

-----------------------------------------------------------------------

Summary of changes:
 savane/savane_user/views.py |   36 ++++++++++++++++++++++--------------
 savane/settings.py          |    2 ++
 2 files changed, 24 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
Savane-cleanup framework




reply via email to

[Prev in Thread] Current Thread [Next in Thread]