# Perspective Default Page After Login

**URL:** <https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 25, 2021, 4:05pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829 "2021-02-25T16:05:58Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 25, 2021, 4:05pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/1 "2021-02-25T16:05:58Z")

</div>

Is there a way to set up a Perspective project so that everytime a user logs in they are directed to a specific page? We are working on a database/dashboard project and the client would like to be re-directed to the home page whenever a user logs in. Right now if a user is logged out for inactivity and logs back in it seems that they are sent to the last page they were looking at. I’d like to be able to force them to the home page upon re-authentication.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 25, 2021, 5:05pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/2 "2021-02-25T17:05:10Z")

</div>

Could you put a navigate call in a change script on the username of the auth object in session properties?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 25, 2021, 7:21pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/3 "2021-02-25T19:21:59Z")

</div>

I tried… it doesn’t seem to trigger the change script on logout/login of the same user.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 25, 2021, 7:31pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/4 "2021-02-25T19:31:49Z")

</div>

Odd… It did for me (8.1.3, but this behavior shouldn’t have changed anytime recently).

Change Script:

```auto
system.util.getLogger('USER').info(str(currentValue.value))

```

Logs after session start, login, logout, re-login:

 ![Screen Shot 2021-02-25 at 11.29.44AM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/5/559a86782419ee00f055e610e4fbda4cadcec282.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 25, 2021, 7:34pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/5 "2021-02-25T19:34:56Z")

</div>

Hmm… I’m running 8.1.1

Let me try again and make sure I didn’t miss anything. I did just get a fresh cup of coffee.

I’m also using the default IDP if that matters.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 25, 2021, 7:36pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/6 "2021-02-25T19:36:45Z")

</div>

Check your logs for any errors, just to verify a lack of action wasn’t a faulted script.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 25, 2021, 7:42pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/7 "2021-02-25T19:42:44Z")

</div>

> [@cmallonee](#):
>
> system.util.getLogger('USER').info(str(currentValue.value))

Still nothing. No Errors either.

I'm showing the socket connection to session notice, but nothing from that change script. Just to make sure I'm not crazy this is what we are talking about correct?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/9/89cdddfad5acf239c858d8467471bd2072b38926.png)

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 25, 2021, 7:46pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/8 "2021-02-25T19:46:30Z")

</div>

You should absolutely be seeing entries in the Gateway logs with that script if you’re logging in and out. I have to ask, but did you save the project?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 25, 2021, 7:48pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/9 "2021-02-25T19:48:19Z")

</div>

Yep. 😃

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 25, 2021, 9:27pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/10 "2021-02-25T21:27:26Z")

</div>

We aren’t able to replicate the lack of logging. Someone else brought up that there could be a potential race condition in my navigation idea, which means it might not work in some conditions.

A _better_ approach would be to have that change script set a custom session property which acts like a flag - something like `new_sign_in` - and you set that flag to `True` anytime the username changes. In a Page Startup script you should check against that flag and if it’s true you should send a session-scope message with `system.util.sendMessage()`. When the session (NOT component - so you should have a configured Session Message Handler) receives that message, it should iterate through each page it’s aware of and navigate that page to your default page.

Of course none of this matters if your change script isn’t working. Since I can’t replicate, I can’t explain why it’s not working. You might need to reach out to support.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 25, 2021, 9:30pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/11 "2021-02-25T21:30:14Z")

</div>

OK. I’ve tried on two different Gateways both upgraded to 8.1.3 RC1 and same issue. So there is something weird going on.

I’ll get with support when I have some time.

Thanks for the help

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [February 25, 2021, 9:39pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/12 "2021-02-25T21:39:01Z")

</div>

It just seems to be the session.props.auth object. None of the value changed will fire on any of those props. However if I setup a value changed on say the theme I get that one 100% of the time.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 25, 2021, 10:05pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/13 "2021-02-25T22:05:15Z")

</div>

Does the project REQUIRE authentication? If so, then those values initialize with the user’s values on startup, which is not a “change”.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [March 25, 2021, 12:34pm UTC](https://forum.inductiveautomation.com/t/perspective-default-page-after-login/43829/14 "2021-03-25T12:34:04Z")

</div>

@cmallonee sorry to take so long to update.

I did engage support on this, and yes we are requiring authentication as this is a sensitive business application. Support suggested putting a script in the onStartup of the session which does fire in the way that we need it to.

Now to work on iterating though the pages and send them message to navigate home when that session starts up.
