It is currently Sun Sep 23, 2018 2:41 am




 Page 1 of 1 [ 1 post ] 
Author Message
 Post subject: Direct Login Tutorial
PostPosted: Mon May 04, 2009 9:29 pm 
Support Staff

Joined: Fri Nov 01, 2002 4:06 am
Posts: 43
ChatBlazer's Direct Login mechanism allows your users to login to the chat room without a need for manual authentication, i.e. keying in username and password. This feature is most often used when the chat client is integrated with your website and your users are already authenticated on your website. You do not want them to go through the hassle of logging in again just to get into the chat room.

Direct Login is a purely client-side configuration, there is no configuration to be done on the server end.

For Direct Login to work, you need to specify at least a username, optionally a password for member logins, and then a room name / ID so that users go straight into a room after the login process.

Changes to be done on the HTML code containing the chat client.
// username and password used for direct login only
var directUsername   = "";
var directPassword   = "";
var roomPassword   = "";
var roomID         = "";
var roomName      = "";


These variables need to be populated with the information of the user being logged in. In the simplest form (though not a secure approach) is to simply use parameters from the URL. In most cases, you should use your session variables that are prepopulated when users log in.

E.g. The chat client page's URL is http://xyz/chat.php?name=MyUser&password=MyPassword. The above code fragment will look like:
// PHP code sample
// username and password used for direct login only
var directUsername = "<?= $_GET['name'] ?>";
var directPassword = "<?= $_GET['password'] ?>";


In the client's configuration config.xml, make the following changes. (Set "true" to direct-login and direct-entry. The other attributes can be blank.)
<login allowmember="true" allowguest="true" defaultmember="false" allowrelogin="true" allowremember="true">
  <direct-login enabled="true" username="" password="" />
  <direct-entry enabled="true" roomname="" roomid="" password="" />
  <direct-private-chat enabled="false" cid="" />
</login>


If you want the user to go straight into a room, specify either the room's numeric ID or just the name of the room. Otherwise, the user will be presented with the usual list of rooms after login has been completed.

var roomID = "1001";
// OR
var roomName = "My Chat Room";


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

cron