How to set default login page

0
Hi, I have created two html pages in the theme\web folder – ‘login.html’ and ‘back.html’. How can I set the ‘login.html’ as default page so whenever the users enter the application URL “mymendixapp.dummy.com” they should be redirected to  “mymendixapp.dummy.com/login.html” and should be redirected to “mymendixapp.dummy.com/back.html” only when they specify “back.html” in the URL?   Currently the behavior looks random as some users are being redirected to “mymendixapp.dummy.com/login.html” and some users are being redirected to “mymendixapp.dummy.com/back.html” when they are trying to access “mymendixapp.dummy.com”
asked
2 answers
1

Hi Shardul,

In addition to what Dinesh mentioned, here is more information that could help:

  1. If you don’t have index.html in your theme folder you can always copy that from your deployment folder as mentioned here
  2. The behavior may not be random – it seems that if a user uses back.html then its saved in the cookie and then when those users use “mymendixapp.dummy.com” they are redirected to back.html (unless the cookie expires). Ideally the cookie should be reset when the user opens your app url by default. Check the value of this cookie when you reload the page in the browser or add statements in index.html to check its value

If you always want to redirect to login.html if users use your app url, try changing the line in index.html to:

 if (!document.cookie || !document.cookie.match(/originURI=login/gi))

 More information on this here

You can also add your own redirect logic to index.html to ignore cookie.

answered
0

HI Shardul,
The index.html page will  be called initially and then will be redirect to the login.html or any page that is called from the index.html. 


In your index.html check what is mapped in this line :
  document.cookie = "originURI=/login.html" + (window.location.protocol === "https:" ? ";SameSite=None;Secure" : ""); 

 

You can map your page here.

 

 

Hope this helps. 

answered