Example #1
0
    def _process(self):
        if self._params.get("Cancel") is not None:
            self._redirect(urlHandlers.UHUserDetails.getURL(self._avatar))
            return

        msg = ""
        if self._ok:
            ok = True
            authManager = AuthenticatorMgr()
            #first, check if login is free
            if not authManager.isLoginAvailable(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 = authManager.createIdentity( li, self._avatar, self._system )
                authManager.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()
Example #2
0
    def _process(self):
        if self._params.get("Cancel") is not None:
            self._redirect(urlHandlers.UHUserDetails.getURL(self._avatar))
            return

        msg = ""
        if self._ok:
            ok = True
            authManager = AuthenticatorMgr()
            #first, check if login is free
            if not authManager.isLoginAvailable(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 = authManager.createIdentity( li, self._avatar, self._system )
                authManager.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()
Example #3
0
 def _process(self):
     authManager = AuthenticatorMgr()
     #first, check if login is free
     if not authManager.isLoginAvailable(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 = authManager.createIdentity( li, self._avatar, self._system )
     authManager.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
Example #4
0
 def _process(self):
     authManager = AuthenticatorMgr()
     #first, check if login is free
     if not authManager.isLoginAvailable(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 = authManager.createIdentity( li, self._avatar, self._system )
     authManager.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
Example #5
0
 def _process(self):
     save = False
     authManager = 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._email:
             self._params["msg"] += _("You must enter an email address.") + "<br>"
             save = False
         if not self._login:
             self._params["msg"] += _("You must enter a login.") + "<br>"
             save = False
         if not self._password:
             self._params["msg"] += _("You must define a password.") + "<br>"
             save = False
         if self._password != self._passwordBis:
             self._params["msg"] += _("You must enter the same password twice.") + "<br>"
             save = False
         if not authManager.isLoginAvailable(self._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._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._email}, exact=1, searchInAuthenticators=False)
         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._login, self._password)
                 id = authManager.createIdentity(li, a, "Local")
                 authManager.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._login, self._password)
             id = authManager.createIdentity(li, a, "Local")
             authManager.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 "cpEmail" in self._params:
             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()
 def _process(self):
     save = False
     authManager = 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 authManager.isLoginAvailable(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,
                        searchInAuthenticators=False)
         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.UHConfUserExistWithIdentity.getURL(
                         self._conf, a))
                 return
             else:
                 #create the identity to the user and send the comfirmation email
                 li = user.LoginInfo(self._params["login"],
                                     self._params["password"])
                 id = authManager.createIdentity(li, a, "Local")
                 authManager.add(id)
                 DBMgr.getInstance().commit()
                 if minfo.getModerateAccountCreation():
                     mail.sendAccountCreationModeration(a).send()
                 else:
                     mail.sendConfirmationRequest(a, self._conf).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 = authManager.createIdentity(li, a, "Local")
             authManager.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.UHConfUserCreated.getURL(self._conf, a))
     else:
         p = conferences.WPConfUserCreation(self, self._conf, self._params)
         return p.display()