Luckily this is not a real scenario but it does sound like an issue. While I’ll be asking the software team for a solution, I’m wondering if anyone has ideas or already knows the solution.
What if someone chose to create their own custom login page and forgot to add the “login-box”?
Hi @Gassim: we strongly encourage anyone who wants to use a custom login template to test the template before committing it to avoid these types of problems.
When you are changing to use a custom template in the settings app, you should open the login page (Login app | DHIS2) and confirm that the login box appears. If it does not, you need to check that the HTML includes an element with id login-box, e.g. <div id='login-box'></div>
However, if for some reason, you do save your custom login HTML without a login-box, there is a safe mode login available at: DHIS 2 Demo - Sierra Leone.
In the coming months, we will be working to add preview functionality to the settings app, so that this process is clearer and a preview step will be built into the template upload.
You may also want to submit a feature request to have the login app validate that the login-box is included in the HTML, and if not redirect or display link to the safe mode option. We considered this for the first iteration of the app, but decided to put more responsibility on users to check their HTML templates. However, as mentioned, we are looking into how to improve this experience and prevent errors in the future.
I understand and appreciate the decision to make it the responsibility on the users in this case, and it’s good to know they have the safe mode option just in case.
I also thought of another solution, which is to reset the login template using the API:
You can reset the login page theme using the API by making a POST request to /api/41/systemSettings/loginPageLayout including the loginPageLayout DEFAULT or SIDEBAR value in the request body, where content type is set to “text/plain”. As an example, you can use curl like this: