# Profile for Example 2 Registration
# Check for missing required fields
IF MissingReq
RETURN 'examples/example2.fail'
ELSE
# If no req fields are missing, read in the flat file
# 'VoterPollAddresses' from the file storage area
# The contents of that file are read into the variable
# 'emailAddresses'
FF_READ 'VoterPollAddresses'
emailAddresses
# If the email address is not in the registered address book,
IF f.string.find(emailAddresses, Email) == -1
# Add the email address to the existing email list
FF_WRITE 'VoterPollAddresses'
emailAddresses + Email
# Create a unique "Voter ID"
NEWID VoterID
# Save the Voter ID (we do not save any other information
# with it; this is why it is confidential)
TF_WRITE VoterID
# Send the Voter ID to the email address
MAIL
TO Email
FROM 'example2@webkeystone.com'
SUBJECT 'Your Voter ID'
BODY 'examples/example2Register.mail'
RETURN 'examples/example2Register.bye'
# If the email address IS in the address book, return the fail message
ELSE
RETURN 'examples/example2Register.fail'
|