Customize the Log On Page
- Last UpdatedJul 31, 2024
- 2 minute read
You can customize the log in page of AVEVA Work Tasks.
You can have your own log on page instead of AVEVA Work Tasks log on page. You can also use AVEVA Work Tasks product to customize your application.
Note: The code provided below is a sample for reference. You can design the Log On page according to your specific requirements.
To customize the log on page
-
Go to [AVEVA Work Tasks Installed Path]\AVEVA\Work Tasks\Web\BPMUITemplates\Default\Repository\Site folder.
-
Create your custom allows you to customize the login page.
Open RepositoryList.aspx page. In that, under the javascript function named "SetRepositoryValues (provtext, repo, instanceName, providerName,repositoryGuid)" you can find the below code. This is for redirecting to default log on page [Login.aspx].
var winObj = window.open('Login.aspx?_repo='+repo+' &_instanceName='+instanceName+
'&_provtext='+provtext+'&_prov='+providerName,winName,
'top=0,left=0,width='+strWidth+',height='+strHeight+',
location=0, status=1, scrollbars=0, resizable=yes');
To redirect to your custom login page, update the above code by replacing Login.aspx with your custom login page name and put your login page in the [AVEVA Work Tasks Installed Path]\AVEVA\Work Tasks\BPM.NET\Web\BPMUITemplates\Default\Repository\Site folder.
Example: If the Custom Login Page name is HRLogin.aspx, then the code will be updated as shown below.
var winObj = window.open('HRLogin.aspx?_ repo= '+repo+' &_instanceName='+instanceName+' &_provtext='+provtext+'&_prov='+providerName,winName,'top=0,left=0,width='+strWidth+',height='+strHeight+',location=0, status=1, scrollbars=0, resizable=yes');
-
Add the below code in the CS [codebehind] file of the custom login page to authenticate the user and to redirect to your home page. Add SE.Bpm.Convertors namespace in the 'Using' section of the codebehind file.
You have to provide:
-
Page you want to redirect (in this case it is "HRHome.aspx").
-
Username and Password of the user (make sure the user is available in your data source).
//On click of label HR, this event will occur
protected void lbSiteAdmin_Click(object sender, EventArgs e)
{
// To authenticate the specific User.
// The function takes in Username and password as parameters.
this.CreateUserContext("HRadmin", "admin");//Username and Password values are //hardcoded here,you can pass these values from the login page
string redirectPageAfterLogin = "HRHome.aspx";//specify the home page
Response.Write("<script language='Javascript'> location.href = '" + redirectPageAfterLogin + "';</script>");
}
private void CreateUserContext(string username, string password)
{
string applicationname, providerinstancename, providerinstancedisplayname, provider = "";
applicationname = Convert.ToString(Request.QueryString["_repo"]);
providerinstancename = Convert.ToString(Request.QueryString["_instanceName"]);
providerinstancedisplayname = Convert.ToString(Request.QueryString["_provtext"]);
provider = Convert.ToString(Request.QueryString["_prov"]);
Response.Cookies["_instanceName"].Value = HttpUtility.UrlEncode(providerinstancename).Encrypt(15);
Response.Cookies["_repo"].Value = HttpUtility.UrlEncode(applicationname).Encrypt(12);
Response.Cookies["_provtext"].Value = HttpUtility.UrlEncode(providerinstancedisplayname).Encrypt(14);
Response.Cookies["_prov"].Value = HttpUtility.UrlEncode(provider).Encrypt(13);
Response.Cookies["_userinfo"].Value = HttpUtility.UrlEncode(username).Encrypt(11);
Skelta.Core.ApplicationObject application = new Skelta.Core.ApplicationObject(applicationname);
Skelta.Entity.Entity userEntity = Skelta.Entity.Entity.GetEntity(application, "UserEntity");
object userUniqueIdentifier = userEntity.DataBridge.DataBridgeProviders[providerinstancename].GetUniqueIdentifier(username, password);
//Getting user context
Skelta.Entity.UserContext uContext = new Skelta.Entity.UserContext(userUniqueIdentifier,
application, providerinstancename, "", "", false);
}
-
-
After making changes to the pages, now login to the application [From EC site]. This will redirect to your login page. For more information on creating custom page and redirecting to your login page, refer to Create Custom Page.
-
Log on to your custom login page, this will redirect to the page which you had specified. In the above sample, when you click the label named HR, it will redirect to HRLogin.aspx.