mango r143 - in trunk: . lib templates



Author: ovitters
Date: Tue May 20 20:26:18 2008
New Revision: 143
URL: http://svn.gnome.org/viewvc/mango?rev=143&view=rev

Log:
	* lib/user.php:
	* templates/user_instructions.xsl: Inform the user regarding SSH key
	changes. Initial version.. untested.



Modified:
   trunk/ChangeLog
   trunk/lib/user.php
   trunk/templates/user_instructions.xsl

Modified: trunk/lib/user.php
==============================================================================
--- trunk/lib/user.php	(original)
+++ trunk/lib/user.php	Tue May 20 20:26:18 2008
@@ -282,6 +282,13 @@
             $keychanges = array();
             foreach($newkeys as $key) {
                 $keychanges['authorizedKey'][] = $key;
+
+                $fingerprint = is_valid_ssh_pub_key($key, False, True);
+                if ($fingerprint !== false) {
+                    $changes[] = array('id'=>'key-add', "key"=>$key, "fingerprint"=>$fingerprint);
+                } else {
+                    $changes[] = array('id'=>'key-add', "key"=>$key);
+                }
             }
             if (!$olduser->pubkeyauthenticationuser) {
                 $keychanges['objectclass'][] = "pubkeyAuthenticationUser";
@@ -444,6 +451,10 @@
         $node->appendChild($dom->createTextNode($this->description));
         foreach($this->authorizedKeys as $authorizedKey) {
             $node = $formnode->appendChild($dom->createElement("authorizedKey"));
+            $fingerprint = is_valid_ssh_pub_key($key, False, True);
+            if ($fingerprint !== false) {
+                $node->setAttribute("fingerprint", $fingerprint);
+            }
             $node->appendChild($dom->createTextNode($authorizedKey));
         }
         foreach($this->groups as $group) {

Modified: trunk/templates/user_instructions.xsl
==============================================================================
--- trunk/templates/user_instructions.xsl	(original)
+++ trunk/templates/user_instructions.xsl	Tue May 20 20:26:18 2008
@@ -11,7 +11,8 @@
   <xsl:output method="text" encoding="UTF-8" omit-xml-declaration="yes"/>
 
   <xsl:template match="user_instructions"><xsl:variable
-      name="output"><xsl:if
+      name="output"><xsl:if test="boolean(change[ id='keyadded'])"><xsl:call-template 
+	  name="keysadded"/></xsl:if><xsl:if
 	test="boolean(change[ id='joined-group' and @cn='gnomecvs']) or
 	(boolean(change[ id='newuser']) and
 	boolean(user/group[ cn='gnomecvs']))"><xsl:call-template
@@ -83,5 +84,22 @@
 hour from now. Remember to follow the rules outlined on
 http://developer.gnome.org/doc/policies/accounts/mail.html when using
 your mail alias.
+</xsl:template><xsl:template name="keysadded">
+One or more SSH keys has been added to your GNOME account. It will take
+up to an hour before these changes are reflected on the server.
+
+The following SSH keys are currently set on your account:
+<xsl:for-each select="user/authorizedKey">
+  <xsl:choose>
+    <xsl:when test="boolean(@fingerprint)">
+      <xsl:value-of select="@fingerprint"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="concat(substring(., 0, 20), '...', substring(., string-length(.) - 40))"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:for-each>
+
+
 </xsl:template>
 </xsl:stylesheet>



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