cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Can we create custom login page without providing org name in Thingworx?

vvaidya
1-Visitor

Can we create custom login page without providing org name in Thingworx?

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)

Aanjan Ravi​@

Any idea.

Thanks in Advance!

Regards,

Vishal Vaidya

7 REPLIES 7
Aanjan
12-Amethyst
(To:vvaidya)

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.

aelgov
1-Visitor
(To:Aanjan)

Can you please provide more information?

PaiChung
22-Sapphire I
(To:aelgov)

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 &copy; 2011 ThingWorx. All rights reserved.  Version: 2.0.0</span>

  </div>

  </div>

</body>

</html>

aelgov
1-Visitor
(To:PaiChung)

Thanks.

What do I do with it?

PaiChung
22-Sapphire I
(To:aelgov)

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

aelgov
1-Visitor
(To:PaiChung)

Create your own webpage (html) - Done

How do I lunch it into mashup?

atahri
4-Participant
(To:aelgov)

Hello, I have the same problem. Can you  post more information about how you did it. 

Announcements


Top Tags