Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi All,
I want to create a custom login page which redirects my user to a mashup on successful authentication. I want to handle the invalid credentials in the same custom page. (Should not redirect to form login page)
Any idea.
Thanks in Advance!
Regards,
Vishal Vaidya
Vishal, you can probably still use the FormLogin's html structure, but create your own custom page around it. Please take a look at the html page source of a FormLogin page to see what loads, and where the credentials are getting pushed to.
Can you please provide more information?
Here is a jsp example
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<link rel="stylesheet" href="/Thingworx/css/thingworx.css" type="text/css" media="screen" charset="utf-8" />
<title>Thingworx Form-Based Login</title>
<script type="text/javascript">
function GoToMenu(){
window.open("/Thingworx/ThingworxMain.html", "ThingWorx Menu","",true);
}
</script>
</head>
<body>
<div class="main-wrapper">
<div class="header-wrapper">
<div class="header">
<div class="top-links">
<a href="/Thingworx/ThingworxPasswordChange.jsp" class="toplink">Change Password</a> |
<a style="text-decoration: underline;cursor:pointer" onclick="invokeLogoutService()" class="toplink">Log Out</a>
</div>
<a href="/Thingworx/ThingworxMain.html" class="logo"></a>
<span class="dashboard-title">
<span class="welcome-text">Welcome to ThingWorx</span>
</span>
</div>
</div>
<div class="content-wrapper password-change">
<div class="content">
<FORM METHOD="POST" ACTION="action-login">
<%
String msg = (String)session.getAttribute("loginErrorMessage");
if (msg != null) {
out.println("<h1>There was an error in the login process: " + msg + "</h1><h1>Please try again</h1>");
}
else {
out.println("<h1>Please enter your username and password</h1>");
}
String redirect = (String)session.getAttribute("redirectUri");
if (redirect == null || redirect.isEmpty()){
out.println("<INPUT TYPE=\"hidden\" NAME=\"redirectUri\" VALUE=\"/Thingworx/IDE/Runtime/index.html#target=ThingWorxCommunity&mashup=TWCommHome\"/>");
}
else if (redirect.contains("action-login")) {
out.println("<INPUT TYPE=\"hidden\" NAME=\"redirectUri\" VALUE=\"/Thingworx/IDE/Runtime/index.html#target=ThingWorxCommunity&mashup=TWCommHome\"/>");
}
else {
out.println("<INPUT TYPE=\"hidden\" NAME=\"redirectUri\" VALUE=\"" + redirect + "\"/>");
}
%>
<TABLE>
<TR class="current-password"><TD class="form-label">
<label>Name:</label>
</TD>
<TD>
<INPUT class="form-field" id="thingworx-form-userid" NAME="thingworx-form-userid" VALUE=""/>
</TD>
</TR>
<TR><TD class="form-label">
<label>Password:</label>
</TD>
<TD>
<INPUT class="form-field" id="thingworx-form-password" TYPE="PASSWORD" NAME="thingworx-form-password" VALUE=""/>
</TD>
</TR>
</TABLE>
<INPUT TYPE="submit" VALUE="Login"/>
<INPUT TYPE="hidden" NAME="x-thingworx-session" VALUE="true"/>
<INPUT type="button" onclick="GoToMenu()" value="Cancel"/>
</FORM>
</div>
</div>
<div class="footer">
<span class="footer-text">Copyright © 2011 ThingWorx. All rights reserved. Version: 2.0.0</span>
</div>
</div>
</body>
</html>
Thanks.
What do I do with it?
Create your own webpage (html) that you can place anywhere to use as the landing page with this jsp form on it and that then launches them into a desired Thingworx mashup using their provided Name and Password
Create your own webpage (html) - Done
How do I lunch it into mashup?
Hello, I have the same problem. Can you post more information about how you did it.