accounts2/fas/fas controllers.py,1.8,1.9 fasLDAP.py,1.7,1.8
Michael Patrick McGrath (mmcgrath)
fedora-extras-commits at redhat.com
Thu Apr 26 19:35:52 UTC 2007
Author: mmcgrath
Update of /cvs/fedora/accounts2/fas/fas
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17141
Modified Files:
controllers.py fasLDAP.py
Log Message:
Major UI changes
Index: controllers.py
===================================================================
RCS file: /cvs/fedora/accounts2/fas/fas/controllers.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- controllers.py 26 Apr 2007 18:31:10 -0000 1.8
+++ controllers.py 26 Apr 2007 19:35:50 -0000 1.9
@@ -67,7 +67,12 @@
user = Person.byUserName(userName)
groups = Groups.byUserName(userName)
groupsPending = Groups.byUserName(userName, unapprovedOnly=True)
- return dict(user=user, groups=groups, groupsPending=groupsPending, action=action)
+ try:
+ groups['cla_done']
+ claDone=True
+ except KeyError:
+ claDone=None
+ return dict(user=user, groups=groups, groupsPending=groupsPending, action=action, claDone=claDone)
@expose(template="fas.templates.editGroup")
@exception_handler(errorMessage,rules="isinstance(tg_exceptions,ValueError)")
@@ -138,7 +143,7 @@
return dict()
newpass = p.generatePassword()
message = turbomail.Message('accounts at fedoraproject.org', p.mail, 'Fedora Project Password Reset')
- message.plain = "You have requested a password reset! Your new password is - %s" % newpass['pass']
+ message.plain = "You have requested a password reset! Your new password is - %s \nPlease go to https://admin.fedoraproject.org/fas/ to change it" % newpass['pass']
turbomail.enqueue(message)
p.__setattr__('userPassword', newpass['hash'])
@@ -164,6 +169,8 @@
users = []
return dict(printList=users, search=search)
+ listUsers = listUser
+
@expose(template='fas.templates.edit')
@exception_handler(errorMessage,rules="isinstance(tg_exceptions,ValueError)")
@identity.require(identity.not_anonymous())
@@ -316,8 +323,23 @@
turbogears.flash('%s does not allow self removal' % group.cn)
turbogears.redirect('editGroup?groupName=%s' % group.cn)
return dict()
+
@expose(template='fas.templates.signUp')
def newAccount(self, cn, givenName, mail, telephoneNumber, postalAddressForm):
+ import turbomail
+ try:
+ Person.newPerson(cn.encode('utf8'), givenName.encode('utf8'), mail.encode('utf8'), telephoneNumber.encode('utf8'), postalAddressForm.encode('utf8'))
+ p = Person.byUserName(cn.encode('utf8'))
+ newpass = p.generatePassword()
+ message = turbomail.Message('accounts at fedoraproject.org', p.mail, 'Fedora Project Password Reset')
+ message.plain = "You have requested a password reset! Your new password is - %s \nPlease go to https://admin.fedoraproject.org/fas/ to change it" % newpass['pass']
+ turbomail.enqueue(message)
+ p.__setattr__('userPassword', newpass['hash'])
+ turbogears.flash('Your password has been emailed to you. Please log in with it and change your password')
+
+ except ldap.ALREADY_EXISTS:
+ turbogears.flash('%s Already Exists, Please pick a different name' % cn)
+ turbogears.redirect('signUp')
return dict()
@expose(template='fas.templates.signUp')
Index: fasLDAP.py
===================================================================
RCS file: /cvs/fedora/accounts2/fas/fas/fasLDAP.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- fasLDAP.py 26 Apr 2007 18:31:10 -0000 1.7
+++ fasLDAP.py 26 Apr 2007 19:35:50 -0000 1.8
@@ -176,8 +176,9 @@
__base = 'ou=People,dc=fedoraproject,dc=org'
__server = Server()
__filter = ''
-
- def new(self, cn=None, givenName=None, mail=None, telephoneNumber=None, postalAddress=None):
+
+ @classmethod
+ def newPerson(self, cn, givenName, mail, telephoneNumber, postalAddress):
import datetime
dt = datetime.datetime.now()
now = '%.2i-%.2i-%.2i %.2i:%.2i:%.2i.%.2i' % (dt.year,
@@ -207,13 +208,19 @@
'telephoneNumber' : telephoneNumber,
'fedoraPersonBugzillaMail' : mail,
'postalAddress' : postalAddress,
- 'fedoraPersonIrcNick' : ''
+ 'fedoraPersonIrcNick' : '',
+ 'userPassword' : 'Disabled'
}
# 'objectClass' : ('fedoraRole')}
print 'cn=%s,%s' % (cn, self.__base)
print attributes
add('cn=%s,%s' % (cn, self.__base), attributes)
-
+ attributes = {
+ 'objectClass' : ('organizationalUnit', 'top'),
+ 'ou' : 'Roles'
+ }
+ add('ou=Roles,cn=%s,%s' % (cn, self.__base), attributes)
+ return 0
def __getattr__(self, attr):
if attr.startswith('_'):
More information about the fedora-extras-commits
mailing list