[Catalyst] Using dojo.io.bind to validate login

Shawn Ferris shawnmferris at yahoo.com
Sat May 20 19:35:38 CEST 2006


Ok -- I am rather new to Catalyst and very new to Ajax.. I apologize up front if none of this makes any sense.

I've got a TT View that's configured with a wrapper.. My goal is to be able to display a login form on any page the user hits, if they're not already logged in. I'm using the dojo.Dialog widget to display the form so that it's modal. I've got everything working, except for the session mgmt.

My bind looks like this: 

    dojo.io.bind({
      url: 'login',
      handler: logonCallback,
      content: {
        username: dojo.byId('v_username').value,
        password: dojo.byId('v_password').value
      }
    });

(on a side note -- I'm not using the formNode variation, which is a concern for me, but for some reason the params weren't making it back to catalyst.. I obviously would rather not see a plaintext password on the URL.. but at least it's working while I test and figure out what I'm doing wrong)

And my 'login' function is this:

sub login : Local {
  my ( $self, $c ) = @_;

  my($username,$password)=(
    $c->request->param('username'),
    $c->request->param('password'),
  );

  if(!$c->login($username,$password)) {
    $c->res->body("LOGON_DENIED");
  } else {
    $c->res->body("LOGON_SUCCESSFUL");
  }
}

The session information is being checked/built correctly.. but now I'm stuck trying to get it back into a cookie for persistence. I'm assuming that I need to set the cookie information from my logonCallback, but I lack the know how. Can someone give me a pointer or two?

Apprecaite it!

SMF





More information about the Catalyst mailing list