6 Replies Latest reply on Jan 31, 2017 9:01 AM by aelgov RSS
    vishalvai Explorer

    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

      • Re: Can we create custom login page without providing org name in Thingworx?
        aanjan Heavyweight Champ

        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.

          • Re: Can we create custom login page without providing org name in Thingworx?
            aelgov Apprentice

            Can you please provide more information?

              • Re: Can we create custom login page without providing org name in Thingworx?
                pchung Collaborator

                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>