Perspective Default Page After Login

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.

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

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

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

Change Script:

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

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

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.

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

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

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?

Yep. :smiley:

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.

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

1 Like

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.

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

@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.