Beispiel #1
0
    def AddEmailAddress(self, strEmailAddress):
        if not strEmailAddress:
            return (None, "No email address entered")
        strEmailAddress = strEmailAddress.strip().replace(" ", "").lower()
        objValidator = StringValidator(strEmailAddress)
        if not objValidator.isEmail():
            return (None, """'%s' is not a valid email address. Please try again or <a href="/ContactDetails">contact the list owner</a>""" % strEmailAddress)

        objOldEmailAddress = SearchOne(self, "E3EmailAddress", "EmailAddress", strEmailAddress)
        if objOldEmailAddress:
            if objOldEmailAddress in self.objectValues():
                return (None, "You have already registered this address (%s)" % strEmailAddress)
            else:
                objOldMember = objOldEmailAddress.unrestrictedTraverse('..')
                if objOldMember.ParkingMember():
                    self.ClaimEmailAddress(objOldEmailAddress, objOldMember)
                    return (objOldEmailAddress, "New email address registered")
                else:
                    return(None, """This email address belongs to someone else. Please <a href="/ContactDetails">contact the list owner</a>""")
        else:
            dodEmailAddress = GetDOD(self, "E3EmailAddress")
            objNewEmailAddress = dodEmailAddress.NewObject(self)
            objNewEmailAddress.EmailAddress = strEmailAddress
            objNewEmailAddress.Confirmed = False
            objNewEmailAddress.RequestConfirmation()
            objCatalogue = GetDataFolder(self, 'E3EmailAddress').Catalogue
            Catalogue(objNewEmailAddress)
            return (objNewEmailAddress, """New email address registered<br>
A confirmation request has been sent to you. Please confirm your email address by following the instructions in the email""")
Beispiel #2
0
def SignUpFormCorrect(objRequest):
    if objRequest.form['EmailAddress'] == "":
        return(0, "No email address entered.<br>Please enter a valid email address and try again.")

    objValidator = StringValidator(objRequest.form['EmailAddress'])
    if not objValidator.isEmail():
        return(0, "Invalid email address entered.<br>Please correct your email address and try again.")
        
    return (1, "")
def ProcessMasterClassSignUp(objRequest, objHere):
    strResult = ""
    objDatabase = pg.connect(dbname = 'mci')

    strParticipantName = cgi.escape(objRequest.form["ParticipantName"])
    strEmailAddress = objRequest.form["EmailAddress"]

    if objRequest.form['EmailAddress'] == "":
        return "No email address entered.<br>Use the 'Back' button to return to the previous screen. Please enter a valid email address and try again."

    objValidator = StringValidator(objRequest.form['EmailAddress'])
    if not objValidator.isEmail():
        return "Invalid email address entered.<br>Use the 'Back' button to return to the previous screen. Please correct your email address and try again."

    lstClassList = GetClassList(objRequest)
    
    AddEnrolmentLog(objDatabase, strParticipantName, strEmailAddress, lstClassList)
    
    intParticipantId = SaveParticipantDetails(objDatabase, strParticipantName, strEmailAddress)

    for strClassId in lstClassList:
        (blnAlreadyEnrolled, intDummy) = IsEnrolled(objDatabase, intParticipantId, strClassId)
        objClass = objHere.restrictedTraverse("/MCI/Masterclasses/" + strClassId)
        strTitle = objClass.ClassTitle
        strDate = objClass.ClassDate.strftime('%a %d %B %Y')
        if blnAlreadyEnrolled:
            strResult = strResult + "You were already enrolled for %s, %s<br>" % (strTitle, strDate)
            (blnDummy, intEnrolmentId) = IsEnrolled(objDatabase, intParticipantId, strClassId)
        else:
            intEnrolmentId = SaveEnrolment(objDatabase, intParticipantId, strClassId)
            strResult = strResult + "You are now enrolled for %s, %s<br>" % (strTitle, strDate)

        SendInitialMessage(objDatabase, intEnrolmentId, strClassId, objHere, strEmailAddress)
        SendAvailableMaterials(objDatabase, intEnrolmentId, objHere)

        if objClass.InstructionsReadyToSend:
            strResult = strResult + "To join the Masterclass, please call the following US number:<br>%s, and enter pin number %s<br>" % (objClass.BridgeNumber, objClass.BridgePin)
            strResult = strResult + "Full instructions, including the phone number, have been sent to %s<br>" % strEmailAddress
        else:
            strResult = strResult + "A welcome message has been sent to %s. Instructions will be sent as soon as possible<br>" % strEmailAddress
        strResult = strResult + "<br>"
    if len(lstClassList) > 1:
        strPlural = "s"
    else:
        strPlural = ""
    strResult = strResult + """If you do not receive the email%s it may be because of overzealous anti-spam software. For any questions please go to the <a href="/ContactUs.html" class="MenuItem">contact details page</a>""" % strPlural

    # If phone details available:
    #   Show phone details
    # Else:
    #   Message: details will be sent out later

    # State the message has been sent out to (email address)
    # if it doesn't arrive, then it may be due to an overzealous spam filter

    return strResult
Beispiel #4
0
def IndividualCoachPageCorrect(objRequest):
    """    - Error: No contact details (telephone number and/or email address)
    - Error: Incorrect email address"""
    if (objRequest.form['EmailAddress'] == "") and (objRequest.form['PhoneNumber'] == ""):
        return (0, "Insufficient contact details given. Please enter a phone number or an email address.")
        
    if (objRequest.form['EmailAddress'] != ""):
        objValidator = StringValidator(objRequest.form['EmailAddress'])
        if not objValidator.isEmail():
            return(0, "Invalid email address entered.<br>Please correct your email address and try again.")
    return (1, "")
Beispiel #5
0
def JoiningScreenCheck(objHere, strUsername, strPassword, strPasswordRepeat, strName, strEmailAddress):
    lstErrors = []
    blnClearPassword = False
    if not strEmailAddress:
        lstErrors.append('Email address must be entered')
    elif EmailAddressExists(objHere, strEmailAddress):
        lstErrors.append('Email address %s already in use by another user' % strEmailAddress)
    else:
        objValidator = StringValidator(strEmailAddress)
        if not objValidator.isEmail():
            lstErrors.append("'%s' is not a valid email address" % strEmailAddress)
    return '<br>'.join(lstErrors)
Beispiel #6
0
def CheckForm(objRequest):
    if BlankField(objRequest, "ContactName"):
        return(0, "No name entered.<br>Please enter your name and try again.")
    
    if BlankField(objRequest, "ContactEmailAddress") and BlankField(objRequest, "ContactPhoneNumber"):
        return(0, "No email address or phone number entered.<br>Please enter valid contact details and try again.")
        
    if objRequest.form.has_key('ContactEmailAddress') and (objRequest.form["ContactEmailAddress"] <> ""):
        objValidator = StringValidator(objRequest.form['ContactEmailAddress'])
        if not objValidator.isEmail():
            return(0, "Invalid email address entered.<br>Please correct your email address and try again.")
        
    return (1, "")
Beispiel #7
0
def ContactFormCorrect(objRequest):
    """- Error: Missing contact details
    - Error: subscription requested but no email address
    - Error: Incorrect email address"""

    if (objRequest.form["PhoneNumber"] == "") and (objRequest.form["EmailAddress"] == ""):
        return(0, "Contact details missing. Please enter a phone number or email address")

    if objRequest.form.has_key("SubscribeToBooksForCoaches") or objRequest.form.has_key("SubscribeToNewsletter"):
        if objRequest.form["EmailAddress"] == "":
            return(0, "Email address missing. Please enter a valid email address")
     
    if (objRequest.form["EmailAddress"] != ""):
        objValidator = StringValidator(objRequest.form['EmailAddress'])
        if not objValidator.isEmail():
            return(0, "Invalid email address entered.<br>Please correct your email address and try again.")

    return(1, "")        
Beispiel #8
0
def DueBookReviewFormCorrect(objRequest):
    """- Error: None of the options ticked
    - Error: No email address entered (blank or standard text still there)
    - Error: Incorrect email address entered"""
    
    if not(objRequest.form.has_key('SubscribeToNewsletter')) and not(objRequest.form.has_key('SubscribeToBooksForCoaches')) and not(objRequest.form.has_key('ContactMeAboutCoaching')):
        return (0, "No option selected.<br>Please choose at least on of the options below and try again.")

    if not(objRequest.form.has_key('EmailAddress')):
        return(0, "No email address entered.<br>Please enter a valid email address and try again.")
        
    if objRequest.form['EmailAddress'] == "":
        return(0, "No email address entered.<br>Please enter a valid email address and try again.")

    if objRequest.form['EmailAddress'] == "My email address":
        return(0, "No email address entered.<br>Please enter a valid email address and try again.")

    objValidator = StringValidator(objRequest.form['EmailAddress'])
    if not objValidator.isEmail():
        return(0, "Invalid email address entered.<br>Please correct your email address and try again.")
        
    return (1, "")
Beispiel #9
0
def ProcessContactForm(objHere):
    strName = GetParameter(objHere.REQUEST, 'Name')
    strEmailAddress = GetParameter(objHere.REQUEST, 'EmailAddress')
    strComments = GetParameter(objHere.REQUEST, 'Comments')
    if not strEmailAddress:
        SetMessage(objHere, 'Please enter an email address and resubmit', '')
        return

    objValidator = StringValidator(strEmailAddress)
    if not objValidator.isEmail():
        SetMessage(objHere, """'%s' is not a valid email address. Please enter a valid email address and resubmit. Alternatively, please send an email to <a href="mailto:[email protected]">[email protected]</a>""" % strEmailAddress)
        return
    if not strComments:
        SetMessage(objHere, 'Please enter your comments and resubmit', '')
        return    
    strMessage = """Someone has just filled in the Euro Coach List comments form. Here are the details:

Name: %s
Email Address: %s
Comments:
%s""" % (strName, strEmailAddress, strComments)
    SendEmail(objHere, strMessage, "ECL Form", "*****@*****.**")
    SetMessage(objHere, '', 'Thanks for your comments. They have been sent to the list owner')
Beispiel #10
0
def ValidEmailAddress(strEmailAddress):
    objValidator = StringValidator(strEmailAddress)
    if objValidator.isEmail():
        return True
    return False