fedora-accounts userbox.cgi,1.37,1.38

Michael Patrick McGrath (mmcgrath) fedora-extras-commits at redhat.com
Fri Apr 27 15:03:17 UTC 2007


Author: mmcgrath

Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4958

Modified Files:
	userbox.cgi 
Log Message:
removed ssh requirement


Index: userbox.cgi
===================================================================
RCS file: /cvs/fedora/fedora-accounts/userbox.cgi,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- userbox.cgi	8 Mar 2006 20:09:34 -0000	1.37
+++ userbox.cgi	27 Apr 2007 15:03:15 -0000	1.38
@@ -25,10 +25,10 @@
     if not value or not value.strip():
         return "Must be filled in"
     if len(value) < 8 or len(value) > 16:
-	return "Wrong length - must be 8-16 hex chars"
+    return "Wrong length - must be 8-16 hex chars"
     m = re.match('[0-9a-f]+', value.lower())
     if not m or m.end() < len(value):
-	return "Invalid GPG KeyID"
+    return "Invalid GPG KeyID"
 
 def check_notempty_onnew(form, field_info, value, action):
     if action != 'create':
@@ -41,7 +41,7 @@
     if action != 'create' and not value:
         return
     if not value or not value.strip():
-        return "Must be filled in"
+        return 
     value = value.strip()
     keylines = value.split('\n')
     for keyline in keylines:
@@ -91,7 +91,7 @@
     {'desc':'Facsimile', 'name':'facsimile', 'maxlen':128},
     {'desc':'Affiliation', 'name':'affiliation', 'maxlen':64},
     {'desc':'<a href="http://fedoraproject.org/wiki/DocsProject/UsingGpg/CreatingKeys">GPG KeyID</a>', 
-	'name':'gpg_keyid', 'maxlen':16, 'check':check_gpg_keyid},
+    'name':'gpg_keyid', 'maxlen':16, 'check':check_gpg_keyid},
     {'desc':'SSHv2 Public Key (attach your ~/.ssh/id_dsa.pub file here)', 'name':'ssh_key', 'maxlen':2048, 'type':'file', 'check':check_sshkey, 'strip':1},
     {'desc':'Password', 'name':'password', 'maxlen':20, 'check':check_notempty, 'type':'password',
      'check':check_notempty_onnew, 'edit_reuse':0},
@@ -121,16 +121,16 @@
             curval = fs.value
         elif I.get('edit_reuse', 1):
             curval = field_values.get(I['name'], '')
-	if curval is None:
+    if curval is None:
             curval = ''
         if I.get('strip', 0):
-	    curval = curval.strip()
+        curval = curval.strip()
         if got_submit:
             cfunc = I.get('check')
             if cfunc:
                 objection = cfunc(form, I, curval, action)
         print "<tr><td align=left valign=top>"
-	the_desc = I['desc']
+    the_desc = I['desc']
         if not I.has_key('check'):
             the_desc += ' (optional)'
         if objection is not None and can_edit:
@@ -141,16 +141,16 @@
             print "%s: " % the_desc
         print "</td><td align=left>"
         if not can_edit:
-	    print '<input type=hidden name="%s" value="%s">%s' % (I['name'], curval, curval)
-	else:
-	    if I.get('type', 'text') != 'text':
+        print '<input type=hidden name="%s" value="%s">%s' % (I['name'], curval, curval)
+    else:
+        if I.get('type', 'text') != 'text':
                 print '<input type="%s" name="%s" value="%s">' % (I['type'], I['name'], curval)
-	    elif I['maxlen'] >= 1024:
-		print '<textarea name="%s" rows=4 cols=60>%s</textarea>' % (I['name'], curval)
-	    else:
-		print '<input type="text" name="%s" value="%s" maxlength=%s size=%s>' % (I['name'], curval,
-										       I['maxlen'],
-										       min(I['maxlen'], 60))
+        elif I['maxlen'] >= 1024:
+        print '<textarea name="%s" rows=4 cols=60>%s</textarea>' % (I['name'], curval)
+        else:
+        print '<input type="text" name="%s" value="%s" maxlength=%s size=%s>' % (I['name'], curval,
+                                               I['maxlen'],
+                                               min(I['maxlen'], 60))
         if I.has_key('notes'):
             print "</td></tr><tr><td colspan=2><i>%s</i>" % I['notes']
         print "<br><br></td></tr>"
@@ -168,13 +168,13 @@
             if not I.get('skip_empty', 1):
                 val = ''
             if form.has_key(I['name']):
-		fs = form[I['name']]
+        fs = form[I['name']]
                 val = fs.value
-	    if I.get('strip', 0):
-		val = val.strip()
+        if I.get('strip', 0):
+        val = val.strip()
             field_values[I['name']] = val
-	field_values['approval_status'] = 'approved'
-	field_values['username'] = field_values['username'].lower()
+    field_values['approval_status'] = 'approved'
+    field_values['username'] = field_values['username'].lower()
         try:
             dbc.execute("INSERT INTO person (username, human_name, email, gpg_keyid, ssh_key, password, comments, postal_address, affiliation, telephone, facsimile, approval_status) VALUES (%(username)s, %(human_name)s, %(email)s, %(gpg_keyid)s, %(ssh_key)s, %(password)s, %(comments)s, %(postal_address)s, %(affiliation)s, %(telephone)s, %(facsimile)s, %(approval_status)s)",
                         field_values)
@@ -196,10 +196,10 @@
             if not form.has_key(Iname):
                 value = ''
             else:
-		fs = form[Iname]
+        fs = form[Iname]
                 value = fs.value
-	    if I.get('strip', 0):
-		value = value.strip()
+        if I.get('strip', 0):
+        value = value.strip()
             if value != arow[Iname] and (not I.get('skip_empty', 1) or value):
                 changes.append((Iname, value))
         if not len(changes):
@@ -247,17 +247,17 @@
 
 username = None
 if action == 'edit' and (not form.has_key('username') or not form['username'].value):
-	username = auth_username
+    username = auth_username
 
 if form.has_key('username') and action != 'create':
     username = form['username'].value
     if username != auth_username and not website.have_group(dbh, auth_username, 'accounts'):
-	print "Here are some of the main details about this user:"
+    print "Here are some of the main details about this user:"
 
-	uinfo = website.get_user_info(dbh, username)
-	grlist = website.get_user_groups(dbh, uinfo['id'], role_status=('unapproved', 'approved'))
-	uinfo['grouplist'] = ' '.join(map(lambda x: '%s(%s/%s)' % (x[1], x[2], x[3]), grlist))
-	print """
+    uinfo = website.get_user_info(dbh, username)
+    grlist = website.get_user_groups(dbh, uinfo['id'], role_status=('unapproved', 'approved'))
+    uinfo['grouplist'] = ' '.join(map(lambda x: '%s(%s/%s)' % (x[1], x[2], x[3]), grlist))
+    print """
 %(username)s is %(human_name)s <<a href="mailto:%(email)s">%(email)s</a>>. Their GPG key ID is %(gpg_keyid)s.
 <p>
 Comments: %(comments)s
@@ -265,8 +265,8 @@
 Member of groups: %(grouplist)s
 """ % uinfo
 
-	website.print_footer("Administrative Interface")
-	sys.exit(1)
+    website.print_footer("Administrative Interface")
+    sys.exit(1)
 
 if 0:
     print """
@@ -281,7 +281,7 @@
 
 got_errors = []
 if got_submit:
-	# Check that they can edit
+    # Check that they can edit
     for I in fields:
         if form.has_key(I['name']):
             fs = form[I['name']]
@@ -303,7 +303,7 @@
         print action_error
     do_form(form, fields, action, got_submit)
     if username and action=='edit':
-	website.handle_group_mods(dbh, form, 'userbox.cgi', username,
+    website.handle_group_mods(dbh, form, 'userbox.cgi', username,
                                   None, fixed_item='username', auth_username=auth_username)
 
 website.print_footer("Fedora User")




More information about the fedora-extras-commits mailing list