Hello,
I would like your opinion about something i've found about the login-maybe
widget example from :
http://www.digitalkingdom.org/rlp/tiki-index.php?page=Learning+About+Weblocks#Wrapping_Things_In_Login_Widgets_A_Better_Way
In the example, the check-login function is in charge of :
- check the credentials
- bounds the real-child-widget slot with the widget created from the
contents of the child-widget slot
So, if i need to store some data in the session, i have to return an objet
from the check-login function.
The check-login function is called from the quickform-form/satisfies lambda
and if the function return a not nil value, the value is stored in the
session.
Now, if i need data stored in the session in the new created child widget,
with the example above i can't.
i can't because the lambda in charge of the creation of the child widget is
called before
the (setf (webapp-session-value *authentication-key*) success) (see
login.lisp).
And the call to (webapp-session-value *authentication-key*) return true,
not the data i wants.
So the solution i've found is :
1) let the check-login function stored in the on-login slot only in charge
of check the credentials
2) bound a new function in the on-success slot in charge of the creation of
the children widget.
So in the example of digikam blog,
the code should be
(defun check-login (login-widget credentials-obj)
"Check the user's login credentials"
(declare (ignore login-widget))
(let* ((login (slot-value credentials-obj 'name))
(passwd (slot-value credentials-obj 'passwd))
(user (search-user login passwd))))
(or user (values nil "User not found or incorrect password"))))
(defun create-cihldren (login-widget credentials-obj)
(when
(login-maybe-child-widget login-widget)
(setf (slot-value login-widget 'real-child-widget) (funcall
(login-maybe-child-widget login-widget)))
(setf (login-maybe-child-widget login-widget) nil)))
Here's some usage
(make-navigation
'main-menu
'home (make-main-page)
'self (make-instance
'login-maybe
:on-success #'create-children
:on-login #'check-login
:child-widget (make-self-page))
am i right ?
Thanks.
Best regards.
--
You received this message because you are subscribed to the Google Groups
"weblocks" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/weblocks/-/PqTdyl4H-UEJ.
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.