This documentation is for the legacy Izenda 6 product. Documentation for the new Izenda 7 product can be found at https://www.izenda.com/docs/
Izenda, out of the box, does not come with a log-in mechanism. However, there variables and functions set up to allow you to authenticate Izenda based on your application's log-in process. For those who are using a stand-alone version, we recommend creating a log-in page. Although Izenda comes with a sample log-in page, it should only be used as a guide and customized for your use cases.
bool AuthenticateUser(string userName, string password, out bool isAdmin) { DataSet ds = AdHocContext.Driver.GetDataSet(AdHocContext.Driver.CreateCommand(string.Format("select 1 from employeeLogin where userName = '{0}' and password = '{1}'",userName,password))); isAdmin = false; string validated = ds.Tables[0].Rows[0][0].ToString(); if (userName.ToLower() == "admin" || userName.ToLower() == "administrator") isAdmin = true; if (validated.Equals("1")) return true; else return false; } void Button1_Click(object sender, EventArgs args) { try{ loginValidator.IsValid = true; bool isAdmin; if (AuthenticateUser(userNameTextbox.Text, userPassword.Value, out isAdmin)) { HttpContext.Current.Session["UserName"] = userNameTextbox.Text; if (isAdmin) HttpContext.Current.Session["Role"] = "Administrator"; else HttpContext.Current.Session["Role"] = "RegularUser"; FormsAuthentication.RedirectFromLoginPage(userNameTextbox.Text, false); return; } loginValidator.IsValid = false; } catch(IndexOutOfRangeException e) { return; } }
Last edited by Kym, 2016-07-12 08:57:48