Hi Marc, send/suspend generates a unique URL. You can use the context to ensure it is only useful once.
Essentially you want something like this... (define (get-url-for-user user) (let/ec return (define submitted-once-already? #f) (define user-clicked-req (send/suspend (λ (k-url) (return k-url)))) (cond [submitted-once-already? (send/back (generate-already-done-page))] [else (set! submitted-once-already? #t) (send/back (generate-survey-page))]))) (define (send-email-to-users user->email) (for ([(u e) (in-hash user->email)]) (send-email e (get-url-for-user u))) (send/back `(html "Done!"))) Jay On Mon, Jan 4, 2016 at 7:10 AM, Marc Kaufmann <marc.kaufman...@gmail.com> wrote: > Hi, > > I want to generate links, which will be sent via email to survey > participants, that depend on the participant, and so that if the form has > been submitted once, it cannot be resubmitted. Obviously > > mysurvey.com/marc > > would work, if there is only one form for user marc, but is totally insecure. > I could use SHA1-encoded identifiers, say if a user's identifier is 1234, > encode it which gives encoded-1234, store both of those values in the > database and when the server sees encoded-1234, return the form appropriate > for user 1234. (They will be different, sometimes only on the submit button, > but usually also the forms.) This also means that I can ensure that the link > only works as long as the form hasn't yet been submitted. > > I am wondering whether there are some functions in the web server that would > make the creation of such links easier, since when I went through the > tutorial on blogs, it seemed like Racket created random-looking URLs with > continuations already. > > Thanks, > Marc > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Jay McCarthy Associate Professor PLT @ CS @ UMass Lowell http://jeapostrophe.github.io "Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great." - D&C 64:33 -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.