how to "encrypt" the password/login for the blog.rb example?
Jonas Pfenniger
zimbatm at oree.ch
Wed Mar 12 06:28:38 EDT 2008
2008/2/25, Albert Ng <twinwing at gmail.com>:
> I'll keep that in mind.
>
> As an aside, using this gem, how would I go about changing the user without
> closing the browser or raising «Unauthorized»? That last pops up a log-in
> window that can't authorize (have to press escape).
There is no perfect solution. Here is what I use in jQuery :
// idea from : http://nanodocumet.homedns.org/rest/
$('#header A.disconnect').click(function() {
try {
if ($.browser.msie) {
// IE clear HTTP Authentication
document.execCommand("ClearAuthenticationCache");
} else {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/logout", true, "logout", "logout");
xhr.send(null);
xhr.abort();
}
} catch(e) { error(e) }
})
---------
* the /logout url should respond "Unauthorized" for the logout:logout credential
* the xhr.open is called with async to true, otherwise the browser
shows the login window
--
Cheers,
Jonas
More information about the Camping-list
mailing list