Exemple #1
0
    def _process( self ):

        if self._params.get("Cancel",None) is not None :
            p = adminPages.WPUserDetails( self, self._avatar )
            return p.display()

        msg = ""
        ok = False
        if self._ok:
            ok = True
            ih = AuthenticatorMgr()
            #first, check if login is free
            if not ih.isLoginFree(self._login):
                msg += "Sorry, the login you requested is already in use. Please choose another one.<br>"
                ok = False
            if not self._pwd:
                msg += "you must enter a password<br>"
                ok = False
            #then, check if password is OK
            if self._pwd != self._pwdBis:
                msg += "You must enter the same password twice<br>"
                ok = False
            if ok:
                #create the indentity
                li = user.LoginInfo( self._login, self._pwd )
                id = ih.createIdentity( li, self._avatar, self._system )
                ih.add( id )
                self._redirect( urlHandlers.UHUserDetails.getURL( self._avatar ) )
                return

        self._params["msg"] = msg
        p = adminPages.WPIdentityCreation( self, self._avatar, self._params )
        return p.display()
Exemple #2
0
    def _process(self):

        if self._params.get("Cancel", None) is not None:
            p = adminPages.WPUserDetails(self, self._avatar)
            return p.display()

        msg = ""
        ok = False
        if self._ok:
            ok = True
            ih = AuthenticatorMgr()
            #first, check if login is free
            if not ih.isLoginFree(self._login):
                msg += "Sorry, the login you requested is already in use. Please choose another one.<br>"
                ok = False
            if not self._pwd:
                msg += "you must enter a password<br>"
                ok = False
            #then, check if password is OK
            if self._pwd != self._pwdBis:
                msg += "You must enter the same password twice<br>"
                ok = False
            if ok:
                #create the indentity
                li = user.LoginInfo(self._login, self._pwd)
                id = ih.createIdentity(li, self._avatar, self._system)
                ih.add(id)
                self._redirect(urlHandlers.UHUserDetails.getURL(self._avatar))
                return

        self._params["msg"] = msg
        p = adminPages.WPIdentityCreation(self, self._avatar, self._params)
        return p.display()
Exemple #3
0
 def _process( self ):
     ih = AuthenticatorMgr()
     #first, check if login is free
     if not ih.isLoginFree(self._login):
         self._redirect(self._fromURL + "&msg=Login not avaible")
         return
     #then, check if password is OK
     if self._pwd != self._pwdBis:
         self._redirect(self._fromURL + "&msg=You must enter the same password twice")
         return
     #create the indentity
     li = user.LoginInfo( self._login, self._pwd )
     id = ih.createIdentity( li, self._avatar, self._system )
     ih.add( id )
     #commit and if OK, send activation mail
     DBMgr.getInstance().commit()
     scr = mail.sendConfirmationRequest(self._avatar)
     scr.send()
     self._redirect( urlHandlers.UHUserDetails.getURL( self._avatar ) ) #to set to the returnURL
Exemple #4
0
 def _process(self):
     ih = AuthenticatorMgr()
     #first, check if login is free
     if not ih.isLoginFree(self._login):
         self._redirect(self._fromURL + "&msg=Login not avaible")
         return
     #then, check if password is OK
     if self._pwd != self._pwdBis:
         self._redirect(self._fromURL +
                        "&msg=You must enter the same password twice")
         return
     #create the indentity
     li = user.LoginInfo(self._login, self._pwd)
     id = ih.createIdentity(li, self._avatar, self._system)
     ih.add(id)
     #commit and if OK, send activation mail
     DBMgr.getInstance().commit()
     scr = mail.sendConfirmationRequest(self._avatar)
     scr.send()
     self._redirect(urlHandlers.UHUserDetails.getURL(
         self._avatar))  #to set to the returnURL
Exemple #5
0
 def _process( self ):
     save = False
     ih = AuthenticatorMgr()
     minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
     self._params["msg"] = ""
     if self._save:
         save = True
         #check submited data
         if not self._params.get("name",""):
             self._params["msg"] += _("You must enter a name.")+"<br>"
             save = False
         if not self._params.get("surName",""):
             self._params["msg"] += _("You must enter a surname.")+"<br>"
             save = False
         if not self._params.get("organisation",""):
             self._params["msg"] += _("You must enter the name of your organisation.")+"<br>"
             save = False
         if not self._params.get("email",""):
             self._params["msg"] += _("You must enter an email address.")+"<br>"
             save = False
         if not self._params.get("login",""):
             self._params["msg"] += _("You must enter a login.")+"<br>"
             save = False
         if not self._params.get("password",""):
             self._params["msg"] += _("You must define a password.")+"<br>"
             save = False
         if self._params.get("password","") != self._params.get("passwordBis",""):
             self._params["msg"] += _("You must enter the same password twice.")+"<br>"
             save = False
         if not ih.isLoginFree(self._params.get("login","")):
             self._params["msg"] += _("Sorry, the login you requested is already in use. Please choose another one.")+"<br>"
             save = False
         if not self._validMail(self._params.get("email","")):
             self._params["msg"]+= _("You must enter a valid email address")
             save = False
     if save:
         #Data are OK, Now check if there is an existing user or create a new one
         ah = user.AvatarHolder()
         res =  ah.match({"email": self._params["email"]}, exact=1, forceWithoutExtAuth=True)
         if res:
             #we find a user with the same email
             a = res[0]
             #check if the user have an identity:
             if a.getIdentityList():
                 self._redirect( urlHandlers.UHUserExistWithIdentity.getURL(a))
                 return
             else:
                 #create the identity to the user and send the comfirmatio email
                 _UserUtils.setUserData( a, self._params )
                 li = user.LoginInfo( self._params["login"], self._params["password"] )
                 id = ih.createIdentity( li, a, "Local" )
                 ih.add( id )
                 DBMgr.getInstance().commit()
                 if minfo.getModerateAccountCreation():
                     mail.sendAccountCreationModeration(a).send()
                 else:
                     mail.sendConfirmationRequest(a).send()
                     if minfo.getNotifyAccountCreation():
                         mail.sendAccountCreationNotification(a).send()
         else:
             a = user.Avatar()
             _UserUtils.setUserData( a, self._params )
             ah.add(a)
             li = user.LoginInfo( self._params["login"], self._params["password"] )
             id = ih.createIdentity( li, a, "Local" )
             ih.add( id )
             DBMgr.getInstance().commit()
             if minfo.getModerateAccountCreation():
                 mail.sendAccountCreationModeration(a).send()
             else:
                 mail.sendConfirmationRequest(a).send()
                 if minfo.getNotifyAccountCreation():
                     mail.sendAccountCreationNotification(a).send()
         self._redirect(urlHandlers.UHUserCreated.getURL( a ))
     else:
         cp=None
         if self._params.has_key("cpEmail"):
             ph=pendingQueues.PendingQueuesHolder()
             cp=ph.getFirstPending(self._params["cpEmail"])
         if self._aw.getUser() and self._aw.getUser() in minfo.getAdminList().getList():
             p = adminPages.WPUserCreation( self, self._params, cp )
         else:
             p = adminPages.WPUserCreationNonAdmin( self, self._params, cp )
         return p.display()
Exemple #6
0
 def _process(self):
     save = False
     ih = AuthenticatorMgr()
     minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
     self._params["msg"] = ""
     if self._save:
         save = True
         #check submited data
         if not self._params.get("name", ""):
             self._params["msg"] += _("You must enter a name.") + "<br>"
             save = False
         if not self._params.get("surName", ""):
             self._params["msg"] += _("You must enter a surname.") + "<br>"
             save = False
         if not self._params.get("organisation", ""):
             self._params["msg"] += _(
                 "You must enter the name of your organisation.") + "<br>"
             save = False
         if not self._params.get("email", ""):
             self._params["msg"] += _(
                 "You must enter an email address.") + "<br>"
             save = False
         if not self._params.get("login", ""):
             self._params["msg"] += _("You must enter a login.") + "<br>"
             save = False
         if not self._params.get("password", ""):
             self._params["msg"] += _(
                 "You must define a password.") + "<br>"
             save = False
         if self._params.get("password", "") != self._params.get(
                 "passwordBis", ""):
             self._params["msg"] += _(
                 "You must enter the same password twice.") + "<br>"
             save = False
         if not ih.isLoginFree(self._params.get("login", "")):
             self._params["msg"] += _(
                 "Sorry, the login you requested is already in use. Please choose another one."
             ) + "<br>"
             save = False
         if not self._validMail(self._params.get("email", "")):
             self._params["msg"] += _(
                 "You must enter a valid email address")
             save = False
     if save:
         #Data are OK, Now check if there is an existing user or create a new one
         ah = user.AvatarHolder()
         res = ah.match({"email": self._params["email"]},
                        exact=1,
                        forceWithoutExtAuth=True)
         if res:
             #we find a user with the same email
             a = res[0]
             #check if the user have an identity:
             if a.getIdentityList():
                 self._redirect(
                     urlHandlers.UHUserExistWithIdentity.getURL(a))
                 return
             else:
                 #create the identity to the user and send the comfirmatio email
                 _UserUtils.setUserData(a, self._params)
                 li = user.LoginInfo(self._params["login"],
                                     self._params["password"])
                 id = ih.createIdentity(li, a, "Local")
                 ih.add(id)
                 DBMgr.getInstance().commit()
                 if minfo.getModerateAccountCreation():
                     mail.sendAccountCreationModeration(a).send()
                 else:
                     mail.sendConfirmationRequest(a).send()
                     if minfo.getNotifyAccountCreation():
                         mail.sendAccountCreationNotification(a).send()
         else:
             a = user.Avatar()
             _UserUtils.setUserData(a, self._params)
             ah.add(a)
             li = user.LoginInfo(self._params["login"],
                                 self._params["password"])
             id = ih.createIdentity(li, a, "Local")
             ih.add(id)
             DBMgr.getInstance().commit()
             if minfo.getModerateAccountCreation():
                 mail.sendAccountCreationModeration(a).send()
             else:
                 mail.sendConfirmationRequest(a).send()
                 if minfo.getNotifyAccountCreation():
                     mail.sendAccountCreationNotification(a).send()
         self._redirect(urlHandlers.UHUserCreated.getURL(a))
     else:
         cp = None
         if self._params.has_key("cpEmail"):
             ph = pendingQueues.PendingQueuesHolder()
             cp = ph.getFirstPending(self._params["cpEmail"])
         if self._aw.getUser() and self._aw.getUser() in minfo.getAdminList(
         ).getList():
             p = adminPages.WPUserCreation(self, self._params, cp)
         else:
             p = adminPages.WPUserCreationNonAdmin(self, self._params, cp)
         return p.display()