示例#1
0
def UpdatePersonalDetails(objHere):
    strUsername = GetParameter(objHere.REQUEST, 'Username')
    strName = GetParameter(objHere.REQUEST, 'Name')

    strMemberId = GetParameter(objHere.REQUEST, 'MemberId')
    if strMemberId:
        objMember = GetMemberForId(objHere, strMemberId)
    else:
        objMember = GetCurrentMember(objHere)

    blnUpdate = False
    if objMember.Username <> strUsername:
        if strUsername:
            if SearchMany(objHere, 'E3Member', 'Username', strUsername):
                SetMessage(objHere, "The new username is already in use by another member", "")
            else:
                objMember.Username = strUsername
                blnUpdate = True
        else:
            SetMessage(objHere, "The new username can't be empty", "")

    if UpdateName(objMember, strName):
        blnUpdate = True

    if blnUpdate:
        SetMessage(objHere, '', 'Personal details updated')
        Catalogue(objMember)
    return (objMember.Username, objMember.Name)
示例#2
0
def E3Start(objHere):
#    gc.enable()
#    LogMemory(objHere, True)
    strPageTitle = ""
    objRequest = objHere.REQUEST
    objResponse = objRequest.RESPONSE
    if objRequest.has_key('Action'):
        strAction = objRequest['Action']
    else:
        strAction = ''

#    print "Action: ", strAction

    if strAction == 'LogIn':
        (strUsername, strErrorScreen) = ProcessLogInRequest(objHere)
    elif strAction == 'LogOut':
        ProcessLogOutRequest(objHere)
        (strUsername, strErrorScreen) = ('', '')
    elif strAction == 'QuickJoin':
        dictFields = {}
        strUsername = ''
        strErrorScreen = MoreJoiningDetails(objHere)
#    elif strAction == 'Join':
#        (strUsername, strErrorScreen, strPageTitle) = JoinProcessing(objHere)
    else:
        strUsername = GetStatusFromCookies(objHere)
        strErrorScreen = ''

    if strAction == "JoinNow":
#        print "JoinNow in StartStop"
        strUsername = JoinProcessing(objHere)

    StoreTempData(objHere, strUsername, strErrorScreen, strPageTitle)

    strMemberId = GetParameter(objHere.REQUEST, 'MemberId')
    if strMemberId and not ManagerLoggedIn(objHere):
        return

    if strAction == "UpdatePersonalDetails":
        (strNewUsername, strNewName) = UpdatePersonalDetails(objHere)
        if strNewUsername <> strUsername and not strMemberId:
            objTempData = GetTempData(objHere)
            objTempData.Username = strNewUsername
            objTempData.ErrorScreen = strErrorScreen
            objResponse.setCookie('E3Username', strNewUsername, path='/')
        return

    elif 'PasswordReminder' in strAction:
        PasswordReminder(objHere)
        return

    elif strAction == "ContactForm":
        ProcessContactForm(objHere)
        return

    if strMemberId:
        objMember = GetMemberForId(objHere, strMemberId)
    else:
        objMember = GetCurrentMember(objHere)
        if objMember:
            objMember.RecordVisit()

    if strAction == "UpdatePassword":
        if not NeedsMember(objMember):
            return
        (blnPasswordFormCorrect, strErrorMessage) = CheckPasswordForm(objRequest, objMember.Password)
        if blnPasswordFormCorrect:
            strNewPassword = objRequest.form['NewPassword'].strip()
            if objMember.Password <> strNewPassword:
                objMember.Password = strNewPassword
                SetMessage(objHere, '', 'Password changed')
                if not strMemberId:
                    objResponse.setCookie('E3Password', DoEncrypt(strNewPassword), path='/')
        else:
            SetMessage(objMember, strErrorMessage)

    elif strAction == 'UpdateEmailAddresses':
        if not NeedsMember(objMember):
            return
        UpdateEmailAddresses(objHere, objMember)

    elif strAction == 'UpdateEmailAddressesAdvanced':
        if not NeedsMember(objMember):
            return
        UpdateEmailAddressesAdvanced(objHere, objMember)

    elif strAction == "Cancel my membership":
        if not NeedsMember(objMember):
            return
        objMember.CancelMembership()

    elif strAction == "ResumeMembership":
        if not NeedsMember(objMember):
            return
        objMember.UncancelMembership()

    elif strAction == "Unbounce":
        if not NeedsMember(objMember):
            return
        Unbounce(objMember)

    elif strAction == 'ToggleOnHold':
        if not NeedsMember(objMember):
            return
        ToggleOnHold(objMember)

    elif strAction == 'PaymentAction':
        if not NeedsMember(objMember):
            return
        strSubAction = objHere.REQUEST.form['Update']
        strPaymentId = objHere.REQUEST.form['PaymentId']
        if strSubAction == 'Delete':
            objMember.DeletePayment(strPaymentId)
        elif strSubAction == 'Resend Invoice':
            objMember.ResendInvoice(strPaymentId)

    elif strAction == 'NewPayment':
        if not NeedsMember(objMember):
            return
        NewPayment(objMember, objHere)

    elif strAction == 'ConfirmationEmail':
        if not NeedsMember(objMember):
            return
        strEmailId = GetParameter(objHere.REQUEST, 'EmailAddressId')
        SendConfirmationEmail(objHere, strEmailId)

    elif strAction == 'SetPublic':
        if not NeedsMember(objMember):
            return
        SetPublicPrivate(objHere, objMember, True)

    elif strAction == 'SetPrivate':
        SetPublicPrivate(objHere, objMember, False)

    elif strAction == "UpdateEventWillCome":
        if not NeedsMember(objMember):
            return
        strNewValue = GetParameter(objHere.REQUEST, "WillCome")
        strNewName = GetParameter(objHere.REQUEST, "Name")
        UpdateEventWillCome(objMember, strNewValue, strNewName)

    elif strAction == "UpdateEventPreferences":
        if not NeedsMember(objMember):
            return
        UpdateEventPreferences(objHere, objMember)    

    elif strAction == "UpdateEventLocations":
        if not NeedsMember(objMember):
            return
        UpdateEventLocations(objHere, objMember)

    elif strAction == "AddAvailabilityStatement":
        if not NeedsMember(objMember):
            return
        AddAvailabilityStatement(objHere, objMember)

    elif strAction == "DeleteAvailabilityStatements":
        if not NeedsMember(objMember):
            return
        DeleteAvailabilityStatements(objHere, objMember)

    elif strAction == "AddFreePeriod":
        if not NeedsMember(objMember):
            return
        AddFreePeriod(objHere, objMember)

    elif strAction == "UpdateThread":
        if not NeedsMember(objMember):
            return
        UpdateThread(objHere, objMember)

    elif strAction == "UpdateProfile":
        if not NeedsMember(objMember):
            return
        UpdateProfile(objHere, objMember)