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. 7


From: Jonathan Gonzalez V.
Subject: [Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 75431b650d8304e4b5604be5e0b2081f44f5a9ed
Date: Tue, 23 Jun 2009 19:11:53 +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  75431b650d8304e4b5604be5e0b2081f44f5a9ed (commit)
       via  11907cb0e0333e553350033568d7c54173b3a1a1 (commit)
       via  af1360d6a379b1a2695b986ff0c077aa5c2fa020 (commit)
       via  19e608784c9f6d1eac191edb02e35fed45a9fb30 (commit)
       via  fdfe77924ca42027643f91a9e6dcd4a313673136 (commit)
       via  3a09d3e97b10f8009b74ccab55adc0679ead70a3 (commit)
      from  1dfeb3dd2d0f5bb0f56a0ff4ab3508c4654709ff (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=75431b650d8304e4b5604be5e0b2081f44f5a9ed

commit 75431b650d8304e4b5604be5e0b2081f44f5a9ed
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Tue Jun 23 15:08:51 2009 -0400

    The SSH key update works

diff --git a/savane/savane_user/views.py b/savane/savane_user/views.py
index 7fc62da..f76437e 100644
--- a/savane/savane_user/views.py
+++ b/savane/savane_user/views.py
@@ -108,9 +108,29 @@ def sv_ssh_gpg( request ):
 
         if form is not None and form.is_valid():
             if action == 'update_ssh':
-                pass
+                keys = list()
+                for i in range( 1, 6 ):
+                    key_str = 'key_'+str(i)
+                    key = request.POST[ key_str ]
+                    if key != '':
+                        keys.append( key )
+                keys_str = str('###').join( keys )
+
+                request.user.authorized_keys = keys_str
+                request.user.save()
+                success_msg = 'Authorized keys stored.'
             elif action == 'update_gpg':
                 pass
+    else:
+        keys_data = dict({'action':'update_ssh'})
+        keys = request.user.authorized_keys.split('###')
+        i = 1
+        for key in keys:
+            key_str = 'key_'+str(i)
+            keys_data[ key_str ] = key
+            i += 1
+
+        form_ssh = SSHForm( keys_data )
 
     return render_to_response( 'savane_user/ssh_gpg.html',
                                RequestContext( request,
@@ -144,9 +164,10 @@ class GPGForm( forms.Form ):
     action = forms.CharField( widget=forms.HiddenInput, required=True, 
initial='update_gpg' )
 
 class SSHForm( forms.Form ):
-    key_1 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
-    key_2 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
-    key_3 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
-    key_4 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
-    key_5 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
+    widget = forms.TextInput( attrs={'size':'60'} )
+    key_1 = forms.CharField( widget=widget, required=False )
+    key_2 = forms.CharField( widget=widget, required=False )
+    key_3 = forms.CharField( widget=widget, required=False )
+    key_4 = forms.CharField( widget=widget, required=False )
+    key_5 = forms.CharField( widget=widget, required=False )
     action = forms.CharField( widget=forms.HiddenInput, required=True, 
initial='update_ssh' )

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

commit 11907cb0e0333e553350033568d7c54173b3a1a1
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Tue Jun 23 12:50:32 2009 -0400

    Added a new backend to authenticate users

diff --git a/savane/savane_user/backend.py b/savane/savane_user/backend.py
new file mode 100644
index 0000000..6a76f7a
--- /dev/null
+++ b/savane/savane_user/backend.py
@@ -0,0 +1,20 @@
+from savane_user.models import User
+from django.contrib.auth.backends import ModelBackend
+
+class SavaneAuthBackend( ModelBackend ):
+    """
+    Authenticate against the savane_user model
+    """
+    def authenticate( self, username, password ):
+        try:
+            user = User.objects.get(username=username)
+            if user.check_password(password):
+                return user
+        except User.DoesNotExist:
+            return None
+
+    def get_user(self, user_id):
+        try:
+            return User.objects.get(pk=user_id)
+        except User.DoesNotExist:
+            return None
diff --git a/savane/settings.py b/savane/settings.py
index e6dffba..467c12c 100644
--- a/savane/settings.py
+++ b/savane/settings.py
@@ -84,6 +84,10 @@ TEMPLATE_DIRS = (
 )
 STATIC_ROOT = '../media/'
 
+AUTHENTICATION_BACKENDS = (
+    'savane.savane_user.backend.SavaneAuthBackend',
+)
+
 INSTALLED_APPS = (
     'django.contrib.auth',
     'django.contrib.contenttypes',

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

commit af1360d6a379b1a2695b986ff0c077aa5c2fa020
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Tue Jun 23 12:50:10 2009 -0400

    Added the primary view for ssh and gpg keys

diff --git a/savane/savane_user/views.py b/savane/savane_user/views.py
index 399a8f5..7fc62da 100644
--- a/savane/savane_user/views.py
+++ b/savane/savane_user/views.py
@@ -3,6 +3,7 @@ from django.shortcuts import render_to_response
 from django.http import HttpResponse, HttpResponseRedirect
 from django.contrib.auth import authenticate, login, logout
 from django import forms
+from savane_user.models import User
 
 def index( request ):
     return render_to_response( 'savane_user/index.html',
@@ -89,8 +90,33 @@ def sv_resume_skill( request ):
                                                ) )
 
 def sv_ssh_gpg( request ):
+
+    error_msg = None
+    success_msg = None
+
+    form_gpg = GPGForm()
+    form_ssh = SSHForm()
+    form = None
+
+    if request.method == 'POST':
+        action = request.POST['action']
+        if action == 'update_ssh':
+            form_ssh = SSHForm( request.POST )
+            form = form_ssh
+        elif action == 'update_gpg':
+            form_gpg = GPGForm( request.POST )
+
+        if form is not None and form.is_valid():
+            if action == 'update_ssh':
+                pass
+            elif action == 'update_gpg':
+                pass
+
     return render_to_response( 'savane_user/ssh_gpg.html',
                                RequestContext( request,
+                                               { 'form_gpg' : form_gpg,
+                                                 'form_ssh' : form_ssh,
+                                                 }
                                                ) )
 
 class MailForm( forms.Form ):
@@ -112,3 +138,15 @@ class IdentityForm( forms.Form ):
     name = forms.CharField( required = True )
     last_name = forms.CharField( required = False )
     action = forms.CharField( widget=forms.HiddenInput, required=True, 
initial='update_identity' )
+
+class GPGForm( forms.Form ):
+    gpg_key = forms.CharField( widget=forms.Textarea, required=False )
+    action = forms.CharField( widget=forms.HiddenInput, required=True, 
initial='update_gpg' )
+
+class SSHForm( forms.Form ):
+    key_1 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
+    key_2 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
+    key_3 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
+    key_4 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
+    key_5 = forms.CharField( widget=forms.TextInput( attrs={'size':'60'} ), 
required=False )
+    action = forms.CharField( widget=forms.HiddenInput, required=True, 
initial='update_ssh' )
diff --git a/template/savane_user/ssh_gpg.html 
b/template/savane_user/ssh_gpg.html
index a4595f4..df7ef64 100644
--- a/template/savane_user/ssh_gpg.html
+++ b/template/savane_user/ssh_gpg.html
@@ -7,6 +7,20 @@
   <li><a href="{% url savane_user.views.sv_ssh_gpg %}">SSH/GPG Keys</a></li>
 </ul>
 
+<h3>SSH Keys</h3>
+<form method="post">
+  {{ form_ssh.as_p }}
+  <br /><input type="submit" value="Save" name="Save" />
+</form>
+
+
+
+<h3>GPG Key</h3>
+<form method="post">
+  {{ form_gpg.as_p }}
+  <br /><input type="submit" value="Update" name="Update" />
+</form>
+
 
 {% endblock %}
 {% comment %}

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

commit 19e608784c9f6d1eac191edb02e35fed45a9fb30
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Tue Jun 23 12:49:23 2009 -0400

    Removed commented lines

diff --git a/savane/savane_user/models.py b/savane/savane_user/models.py
index 7ebd6f6..6e09594 100644
--- a/savane/savane_user/models.py
+++ b/savane/savane_user/models.py
@@ -1,7 +1,5 @@
 from django.db import models
-#from django.db.models import Manager
 from django.contrib.auth.models import User, UserManager
-#from django.contrib.auth.models import User
 
 class User(User):
     realname = models.CharField(max_length=96)

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

commit fdfe77924ca42027643f91a9e6dcd4a313673136
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Mon Jun 22 13:49:46 2009 -0400

    Modified the login form to use the the template tag url

diff --git a/template/base.html b/template/base.html
index b390e9b..013d968 100644
--- a/template/base.html
+++ b/template/base.html
@@ -46,7 +46,7 @@
     </div>
     {% else %}
     <div class="menu_login">
-      <form action="/user/login" method="post">
+      <form action="{% url savane_user.views.sv_login %}" method="post">
         <input type="hidden" name="uri" value="/" />
         <dl>
           <dt>Login Name:</dt>

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

commit 3a09d3e97b10f8009b74ccab55adc0679ead70a3
Author: Jonathan Gonzalez V <address@hidden(none)>
Date:   Mon Jun 22 13:38:49 2009 -0400

    Fix the icon page to use the proper MEDIA_URL

diff --git a/template/base.html b/template/base.html
index f3b8ac6..b390e9b 100644
--- a/template/base.html
+++ b/template/base.html
@@ -6,7 +6,7 @@
     <meta name="Generator" content="Savane 3.1-cleanup, see 
http://savannah.nongnu.org/projects/savane-cleanup"; />
     <meta http-equiv="Content-Script-Type" content="text/javascript" />
     <link rel="stylesheet" type="text/css" 
href="{{MEDIA_URL}}/css/Savannah.css" />
-    <link rel="icon" type="image/png" href="static/images/icon.png" />
+    <link rel="icon" type="image/png" href="{{MEDIA_URL}}/images/icon.png" />
     <meta name="Author" content="Copyright (C) 2000, 2001, 2002, 2003 Free 
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA 
Verbatim copying and distribution of this entire article is permitted in any 
medium, provided this notice is preserved" />
     <meta name="Keywords" content="Savannah,GNU, FSF, Free Software 
Foundation, GNU/Linux, Linux, Emacs, GCC, Unix, Free Software, Operating 
System, GNU Kernel, HURD, gnus, SourceForge" />
     <meta name="Description" content="Savannah is a central point for 
development, distribution and maintainance of Free Software. It allows 
contributors to easily join existing Free Software projects." />

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

Summary of changes:
 savane/savane_user/backend.py     |   20 ++++++++++++
 savane/savane_user/models.py      |    2 -
 savane/savane_user/views.py       |   59 +++++++++++++++++++++++++++++++++++++
 savane/settings.py                |    4 ++
 template/base.html                |    4 +-
 template/savane_user/ssh_gpg.html |   14 +++++++++
 6 files changed, 99 insertions(+), 4 deletions(-)
 create mode 100644 savane/savane_user/backend.py


hooks/post-receive
-- 
Savane-cleanup framework




reply via email to

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