- Timestamp:
- 27/09/10 13:15:25 (3 years ago)
- Children:
- 1a8a806eb5b7b35bf10f0d5ddaa8cd4bf80c9995
- Parents:
- 3650b5f0c54901838010bfb94244f7e44ed3c094
- git-committer:
- tin <tin@…> (27/09/10 13:15:25)
- File:
-
- 1 edited
-
arma2/idCentral/idcentral/idcentral.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
arma2/idCentral/idcentral/idcentral.py
r03d5364 r2c1e9b3 34 34 implements(IRequestHandler, ITemplateProvider, IPermissionRequestor) 35 35 36 project_id_validator = re.compile("[a-z]+[_\-0-9]*[a-z]*$") 37 sug_project_name = Option('NewProject', 'sug_project_name', 38 doc=u'Sugerencias para el nombre del proyecto') 39 sug_project_id = Option('NewProject', 'sug_project_id', 40 doc=u'Sugerencias para el Id del proyecto') 41 intro = Option('NewProject', 'intro', 42 doc=u'Introducción del formulario de nuevo Proyecto') 43 script = Option('NewProject', 'script', 44 doc=u'Script báshico al que llama luego de parsear los datos '\ 45 u'ingresados, el script debe aceptar los siguientes '\ 46 u'parámetros repo_type project_id titulo owner') 47 max_cant_proj = IntOption('NewProject', 'width', 5, 48 """Cantidad de proyectos por persona""") 49 project_list_cache = [] 50 clear_cache = True 51 repo_type_supported = ['svn', 'hg', 'bzr', 'git'] 36 user_id_validator = re.compile("^[_\-\.a-zA-Z]+$") 37 sug_name_lastname = Option('IdCentral', 'sug_name_lastname', 38 doc=u'Sugerencias para el nombre') 39 sug_user_id = Option('IdCentral', 'sug_project_id', 40 doc=u'Sugerencias para el Id del usuario') 41 sug_usergroup = Option('IdCentral', 'sug_usergroup', 42 doc=u'Sugerencia para el grupo de usuario') 43 sug_texcha = Option('IdCentral', 'sug_texcha', 44 doc=u'Sugerencia para el TexCha') 45 sug_passwd = Option('IdCentral', 'sug_passwd', 46 doc=u'Sugerencia para el Password') 47 sug_confirm_passwd = Option('IdCentral', 'sug_confirm_passwd', 48 doc=u'Sugerencia para el Confirm Password') 49 intro = Option('IdCentral', 'intro', 50 doc=u'Introducción del formulario de nuevo usuario') 52 51 daemon_idCentral = xmlrpclib.ServerProxy("http://localhost:8008", allow_none=1) 53 52 texcha = "" 53 data = {} 54 54 55 55 # IRequestHandler methods … … 59 59 def process_request(self, req): 60 60 add_stylesheet(req, 'nuldap/css/password.css') 61 self. data = {'intro': self.intro}61 self.sugerencias() 62 62 action = req.args.get('action') 63 63 format = req.args.get('format') … … 65 65 if req.method == 'GET': 66 66 self.data['texcha'] = self.texcha = self.daemon_idCentral.getTexcha() 67 self.data['orgs'] = self.daemon_idCentral.listORGs() 67 68 elif req.method == 'POST' and action == 'newuser': 68 self._parser(req)69 #self.create_project()70 #return 'project_created.html', self.data, None71 #add_stylesheet(req, 'common/css/trac.css')69 if self._parser(req): 70 self.daemon_idCentral.createUser(self.data['name_lastname'], 71 self.data['userid'], self.data['passwd'], self.data['lug_selected']) 72 return 'usuario_creado.html', self.data, None 72 73 return 'nuevo_usuario.html', self.data, None 73 74 … … 77 78 valid = True 78 79 self.data['name_lastname'] = req.args.get('name_lastname') 79 self.data['user_put'] = req.args.get('user_put').lower() 80 self.data['lug'] = req.args.get('lug') 81 self.data[self.data['lug']] = {"selected" : "True"} 80 self.data['userid'] = req.args.get('userid').lower() 81 self.data['lug_selected'] = req.args.get('lug') 82 self.data[self.data['lug_selected']] = {"selected" : "True"} 83 self.data['orgs'] = self.daemon_idCentral.listORGs() 82 84 self.data['passwd'] = req.args.get('passwd') 83 85 self.data['confirm_passwd'] = req.args.get('confirm_passwd') … … 90 92 self.data['texcha'] = texcha = self.daemon_idCentral.getTexcha() 91 93 valid = False 94 if not re.match(self.user_id_validator, self.data['userid']): 95 self.data['error_userid'] = u'Tu id Usuario posee carácteres no permitidos' 96 valid = False 97 if len(self.data['name_lastname']) == 0: 98 self.data['error_name_lastname'] = u'El campo Usuario y Apellido es obligatorio' 99 valid = False 100 if self.daemon_idCentral.checkPasswordStrengh(self.data['passwd']) <= 2 and valid: 101 self.data['error_passwd'] = u'Tu contraseña es demasiado debil' 102 valid = False 103 if len(self.data['passwd']) == 0 and valid: 104 self.data['passwd'] = self.daemon_idCentral.generateRandomPassword() 105 self.data['passwd_generated'] = u'Tu password generado es %s' % self.data['passwd'] 92 106 return valid 107 108 def sugerencias(self): 109 self.data['intro'] = self.intro 110 self.data['sug_name_lastname'] = self.sug_name_lastname 111 self.data['sug_user_id'] = self.sug_user_id 112 self.data['sug_usergroup'] = self.sug_usergroup 113 self.data['sug_passwd'] = self.sug_passwd 114 self.data['sug_confirm_passwd'] = self.sug_confirm_passwd 115 self.data['sug_texcha'] = self.sug_texcha 93 116 94 117 # ITemplateProvider methods
Note: See TracChangeset
for help on using the changeset viewer.

