Thank you so much for this incredibly helpful response.  I've been
struggling with trying to get the dispatcher work (and I am still
using the old nav system).  The other example code that I've been
trying to get to run is from 
http://teddyb.org/rlp/tiki-index.php?page=Learning+About+Weblocks.

The error I've been getting has been

SIMPLE-ERROR: There is no class named CONTENTREES::DISPATCHER.
(contentrees is the name of my app)

Here's my code, for reference:

  (make-instance
           'dispatcher
           :on-dispatch (lambda (widget url-bits)
                          (declare (ignore widget))
                          (cond
                            ((string= (first url-bits) "main-page")
                             (make-main-page))
                            ((string= (first url-bits) "account-page")
                             (if (current-user)
                                 (make-account-page)
                                 "You must sign in to see the account page."))
                            ((not url-bits)
                             (make-main-page)))))

I tried using 'hunnchentoot::dispatcher instead, but that didn't seem
to work either.

The example code from the same page with selector hasn't been working
either, but it didn't give me an error, just didn't appear to actually
create any working urls.

I've been reading the navigation code, and while I definitely
understand it better than I did before, I can't figure out what I'm
doing wrong.  Any tips would be extremely helpful, but if you think
the new navigation is stable enough that I should just upgrade to
that, then maybe it makes more sense for me to do so and invest any
further effort in understanding that code.  Thanks,

Divia



On May 29, 12:41 am, "Leslie P. Polzer" <[email protected]>
wrote:
> Divia wrote:
> > I'd like to set up email confirmation for my app (user signs up with
> > an email address, receives an email with a link to click on to confirm
> > that the email address actually belongs to the person who signed up),
> > but I'm confused about how to do this with Weblocks.
>
> Generating a confirmation code:
>
>   (defun confirmation-hash (email)
>     (sha1 (concatenate 'string email "salt")))
>
> Installing a confirmation hash (substitute your own storage
> mechanism for this):
>
>    (defvar *confirmation-hashes* (make-hash-table :test #'equalp))
>
>    (defun register-confirmation-hash (email hash)
>      (setf (gethash email *confirmation-hashes*) hash))
>
>    (defun confirmation-hash-correct-p (email hash)
>      (equalp (gethash email *confirmation-hashes*) hash))
>
> Generating a confirmation link:
>
>   (defun make-confirmation-link (email)
>     (apply #'format nil "http://myhost/confirm-user/~A/~A";
>       (mapcar #'url-encode (list email (confirmation-hash email)))))
>
> Installing a matching dispatcher (old nav system):
>
>   (defwidget top-navigation (navigation)
>     ())
>
>   (defmethod selector-on-dispatch ((selector top-navigation) tokens)
>     (if (and (eql (length tokens) 3)
>              (equalp (first tokens "confirm-user")))
>       (let ((email (second tokens))
>             (hash (third tokens)))
>         (cond
>           ((confirmation-hash-correct-p email hash)
>            (confirm-email email)
>            (values "You got it!" tokens nil))
>           (t
>            (values "Uh, sorry... :/" tokens nil))))
>       (call-next-method))) ; defer to static navigation
>
>   (defun init-user-session (root)
>     (setf (widget-children root)
>           (list (init-navigation (make-instance 'top-navigation :name "Main 
> nav")
>                                  ...))))
>
> Untested.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"weblocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/weblocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to