Hello,
All the pages on my power pages are restricted to a specific user, including the home page. I want to direct the user to the sign-in page when they enter the URL https://mywebsite.powerappsportals.com or https://mywebsite.powerappsportals.com/SignIn. I have added this code to the header to redirect them:
{% if user %}
Hello, {{ user.fullname }}!
{% else %}
<script type="text/javascript">
if (window.location.pathname != "/SignIn") {
window.location.assign("/SignIn?ReturnUrl=%2F");
}
</script>
{% endif %}
however, it always shows the access denied page and then the sign-in page, which looks very unprofessional. I want it to just land on the sign-in page first. Can anyone explain why?
Thank you in advance!