AppliBuilder
Visual Mashup Builder

AppliBuilder User Documentation

Authentication Model and User Authentication

All your applications and the portal use a single user database, which is stored in a Users table of your SQL database.  You applications can use the framework to authenticate users, register them, and provide access to your applications.

Handling Application Login AjaxDb provides few functions to handle application login, register, logout.  Here are few ways in which it can be used

Doing User Login

var username = "tester", password = "tester";
var ajaxdb = new Applibase.db.AjaxDb();
var loginInfo = ajaxdb.doLogin(username, password);
if(loginInfo.username() == null) {
alert("Failed to login.");
}

Doing User Registration

var username = "tester", password = "tester", email = "tester@email.com";
var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.doRegister(username, password, email, registerCallback);
function registerCallback(registerInfo, error) {
if(error != null) { alert(error.message); }
else {
if(registerInfo.isUserBlocked()) alert("User is blocked");
else if(registerInfo.isUserRegistered()) alert("User is already registered");
else if(registerInfo.isMailToSend()) alert("User registration mail will be sent.");
}
}

Doing User Logout

var ajaxdb = new Applibase.db.AjaxDb();
var lgoutdone = ajaxdb.doLogout();
if(lgoutdone == false) {
alert("Failed to logout.");
}

Redirection if User has Logged In

This code can be created as a header code block. If a user is logged it, the page will redirect to the value of document.location.href field.

var ajaxdb = new Applibase.db.AjaxDb();
if(ajaxdb.checkLogin().username() != 'null')
document.location.href='logged.html';

Specify application register type

You can set the type of registration for the application as its property when creating application or modifying application property.

Specify application login page

You can set the login page for your application as its property. If the restricted page (page with roles) is accessed then a redirection to login page will be done if it exists (otherwise framework will handle the user signin and register).

The login page can handle user login in its own fashion using the Login API's. As a part of redirection to the login page, the nexturl to be used after successful login is available as a url parameter.

Here is the code snippet that shows handling login on the login_page:

function doLogin() {
var username = "tester", password = "tester";

var ajaxdb = new Applibase.db.AjaxDb();
var loginInfo = ajaxdb.doLogin(username, password);

if(loginInfo.username() != null) {
var nexturl = (new Applibase.Core()).getURLParameters()["nexturl"];
if(nexturl != null) window.location.href = unescape(nexturl);
else window.location.href = "index.html";
}
}

Logout from Application You can create logout link as follows:

<a href='doLogout'>Simple Logout</a>
<a href='doLogout?redirectURL=myindex.html'>Logout With Redirect</a>

 


© 2006 Applibase, Inc.