Add something new to Virb:

Virb

Are you sure you want to delete that?

or Cancel

 

Posted on Jan 21, 2009

PunBB Authentication JQuery Plugin

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.


Gotchas


As the plugin uses XHR to communicate with PunBB, it's usage is of course limited to the XHR same origin policy.


Download


Source code, as well as downloads, can be found for this plugin on github: http://github.com/leveille/punbbauth/tree/master


Examples


BIND TO LOGIN FORM


ex. 1



//assumes a username fieldname of username
//assumes a password fieldname of password
//also assumes form class structure: <form class="punbb login">
$('.punbb').punbbauth();

ex. 2



//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'
});

BIND TO LOGOUT LINK


ex. 1



//assumes link class structure: <a class="punbb logout">...</a>
$('.punbb').punbbauth();

BIND TO ACCESS LINK


NOTE: This will likely not see very much use, as it requires access to a plain text password. See notes below


ex. 1



//assumes link class structure: <a class="punbb access">...</a>
$('.punbb').punbbauth({
punbb_username : 'username',
punbb_password : 'password'
});



Loading comments...

Likes

Details

Viewed 1 time

© 2009 jleveille

virb.com/t/1046295
tweet!

Flag this text post!

Flag this text post as:

or Cancel

 

Advertisement

Flag this profile!

Flag this profile as:

or Cancel