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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to customize the login page and the login process ?

seanccc
17-Peridot

How to customize the login page and the login process ?

Hi, 

My customer has a requirement,  the user can manage one or more factories.  If a user manage multiple factories then the user can select which factories he need to login in the login page, otherwise he don't need to choose factory .  The home mashup page of different factory may be different or same . 

So the login process would be : 

  1. choose factory in login page  -> check user's authorization of the  factory -> lookup the factory's home mashup ->  open the home mashup of the factory
  2. login without choosing factory ->  find the user's factory -> lookup the factory's home mashup ->  open the home mashup of the factory

 

I have lots of questions here: 

  1. In the login page, how to get the factory list before login in ?  It has to be hard coded list ?
  2. How to send the factory selected in login page to the ThingWorx server ? 
  3. Where can I implement the logic of  checking authorization of user & factory and find the user's factory ? 
  4. How to display the error message in login page if the checking of above step #3 get failed ? 
  5. How to forward to the target factory's home mashup one find it ? 

Regards,

Sean

1 ACCEPTED SOLUTION

Accepted Solutions
slangley
23-Emerald II
(To:slangley)

Hi @seanccc.

 

Part of this would have to be handled outside of ThingWorx.  You might want to advise your customer that there is a greater security risk of exposing the list of factories before the authentication occurs.

 

However, regardless of the path you take, this is a much more involved solution than can be answered here.  We recommend reaching out to Sales for engaging with our global services team for assistance.

 

Regards.

 

--Sharon

View solution in original post

4 REPLIES 4
slangley
23-Emerald II
(To:seanccc)

Hi @seanccc.

 

If you want the user to be able to select the factory prior to login, you would need to create a page outside of ThingWorx that would direct the user based on their selection.

 

Another option available within ThingWorx would be to set up a Master with links to each of the factories to allow the user to choose once they have logged in.  Using the out of the box visibility permissions would allow you to limit visibility to only those factories a user has access to.  If a user has access to only one factory, you should be able to include logic needed to automatically select it.

 

Please let us know if you have further questions.

 

Regards.

 

--Sharon

seanccc
17-Peridot
(To:slangley)

@slangley ,

I've proposed the customer the same for the login solution, but customer  don't like being able to switch factories only after logging in,  this can be a feature after login in, but not the customer's core needs. 

 

So, back to my questions,  I think it's feasible to get the factory list before login outside the mashup and the remaining questions would be : 

  1. How to run custom authorization check during login 
  2. How to forward the request to the factory's home mashup if authorization check get passed
  3. How to display the error message in the custom login page if authorization check get failed .

I found a helpful document : https://www.ptc.com/en/support/article/CS244163

For question #1, I probably may implement in the "authenticate" method. 

For question #2 & #3,  I still do not  have clear idea  , can I simply construct URL of the factory home mashup and call httpResponse.sendRedirect in  "authenticate" method  ?   If doing so, will it cause the other authenticators get ignored ? 

 

Regards,

Sean

 

slangley
23-Emerald II
(To:slangley)

Hi @seanccc.

 

Part of this would have to be handled outside of ThingWorx.  You might want to advise your customer that there is a greater security risk of exposing the list of factories before the authentication occurs.

 

However, regardless of the path you take, this is a much more involved solution than can be answered here.  We recommend reaching out to Sales for engaging with our global services team for assistance.

 

Regards.

 

--Sharon

slangley
23-Emerald II
(To:slangley)

Hi @seanccc.

 

If the previous response answered your question (even if it wasn't the answer you wanted), please mark it as the Accepted Solution for the benefit of others with the same question.

 

Thank you for participating in our community!

 

Regards.

 

--Sharon

Top Tags