Posted on Jan 21, 2009
I have finally created my first jQuery plugin. The punbbauth plugin should provide an easy way to sync authentication between your application and PunBB.
This plugin provides an easy way to hook into PunBB authentication login/logout. Hooks should be applied to your own applications login form and logout link. Another option is available to hook into an "access" link, however this will likely not see much use under most normal circumstances.
This plugin does not attempt to solve the issue of syncing your application with punbb. Rather, it attempts to solve the issue of single sign on when a user logs into your application.
As the plugin uses XHR to communicate with PunBB, it's usage is of course limited to the XHR same origin policy.
Source code, as well as downloads, can be found for this plugin on github: http://github.com/leveille/punbbauth/tree/master
//assumes a username fieldname of username
//assumes a password fieldname of password
//also assumes form class structure: <form class="punbb login">
$('.punbb').punbbauth();
//app_uname_field: <input name="uname_fieldname" />
//app_pword_field: <input name="pword_fieldname" />
//assumes form class structure: <form class="punbb login">
$('.punbb').punbbauth({
app_uname_field : 'uname_fieldname',
app_pword_field : 'pword_fieldname'
});
//assumes link class structure: <a class="punbb logout">...</a>
$('.punbb').punbbauth();
NOTE: This will likely not see very much use, as it requires access to a plain text password. See notes below
//assumes link class structure: <a class="punbb access">...</a>
$('.punbb').punbbauth({
punbb_username : 'username',
punbb_password : 'password'
});
Loading comments...