cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hardikv
Memorable Member
Memorable Member

Redirect to Specific Page after Login

Hi,

 

Once user sign in using local sign in or Azure AD, user must redirect to specific page.

2 ACCEPTED SOLUTIONS

Accepted Solutions
chleverenz
Super User
Super User

Hi @hardikv ,

did you have a look on https://docs.microsoft.com/en-us/powerapps/maker/portals/liquid/liquid-objects#user ?

In fact if there is the need for a user-specific page you could look, whether you are on the home or profilepage or whatever and in case of logged in user navigate to a page, which is somehow user-dependent.

You could also look, whether your page referrer was the login. may be, this could help to identify, that you just logged in...

 

Hope i got the question right, have fun,

  Christian

View solution in original post

Hi @hardikv 

 

Place the below code in your profile web page (Localised content > Custom JavaScript) or any web page depending on your business need. 

 

$( document ).ready(function() {
    console.log(555,"Redirect check");
    $(location).attr('href', 'https://yourportal.powerappsportals.com/contact-us/');

});


 

Done the testing. It is redirecting to contacts page in my case. 


Hope it helps. 
------------

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

View solution in original post

6 REPLIES 6
ragavanrajan
Super User
Super User

Hi @hardikv 

 

Have a look at the below thread mate. 

https://powerusers.microsoft.com/t5/Power-Apps-Portals/Redirect-after-T-amp-C/m-p/912659#M7102 

Hope it helps. 
------------

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

 

chleverenz
Super User
Super User

Hi @hardikv ,

did you have a look on https://docs.microsoft.com/en-us/powerapps/maker/portals/liquid/liquid-objects#user ?

In fact if there is the need for a user-specific page you could look, whether you are on the home or profilepage or whatever and in case of logged in user navigate to a page, which is somehow user-dependent.

You could also look, whether your page referrer was the login. may be, this could help to identify, that you just logged in...

 

Hope i got the question right, have fun,

  Christian

Hi @hardikv 

 

The preferred and standard way is to change the liquid scripting in the Home web template. 

 

The example below is redirecting to the "contact-us" page. 

 

{% if user %}
//if any user logs in
<script>
  window.location.href='./contact-us/'
</script>
{% else %}
//Home web page code, if you don't want to display the page when the user is being redirected
{% endif %}
//Home web page code, if you want to display the page when the user is being redirected

 

Hope it helps. 
------------

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

Hi @ragavanrajan  & @chleverenz 

 

Thanks for your suggestion.

 

I have tried to modify Home Web Template and redirect to specific page. However it is not working as expected.

 

{% if user %}
<script>
  window.location.href='./contact-us/'
</script>
{% else %}

<div class="wrapper-body">
  <section class="page_section section-landing">
    <div class="container">
      <div class="row ">
        <div class="col-md-12">
          <br>
          <br>
          <br>
          <br>
          <h1 class="section-landing-heading">{% editable snippets 'Home/Title' type: 'text' %}</h1><br>
          <h2 class="section-landing-sub-heading">{% editable page 'adx_summary' type: 'html', liquid: true %}</h2>
          <br>
          <br>
        </div>
      </div>
    </div>
  </section>

  <section class="page_section">
    <div class="layer_up">&nbsp;</div>
    <div class="container">
      <div class="content-home">
        {% include 'Page Copy' %}
      </div>
    </div>
    <div class="layer_down">&nbsp;</div>
  </section>
<div class="push"></div>
</div>

{% endif %}

 

Hi @hardikv 

 

Place the below code in your profile web page (Localised content > Custom JavaScript) or any web page depending on your business need. 

 

$( document ).ready(function() {
    console.log(555,"Redirect check");
    $(location).attr('href', 'https://yourportal.powerappsportals.com/contact-us/');

});


 

Done the testing. It is redirecting to contacts page in my case. 


Hope it helps. 
------------

If you like this post, give it a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

hardikv
Memorable Member
Memorable Member

Thanks @ragavanrajan 

 

I have tried above code and it is working.

So, If I put below code in Home - Localized Content Web Page and it is working fine.

$( document ).ready(function() {
    var userData = "{{user.id}}";
    if(userData != undefined && userData != null && userData != "")
    {
        $(location).attr('href', 'https://yourportal.powerappsportals.com/contact-us/');
    }
});

 

If I put above code in Web Page directly, then it is not working. Is there any reason?

Helpful resources

Announcements
MPP IDEAS updated 768x460.png

Ideas

Discover ideas and concepts from users like you for how to use Power Pages and take your work to the next level.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Top Solution Authors
Users online (4,712)