Null login show after some time in the persepective

Hello,

I have create some views and use login and logout option by adding some script
for login I bind to label text I use this {session.props.auth.user.userName}
for logout
if self.session.props.auth.authenticated:
system.perspective.logout()
else:
system.perspective.login()

Now the problem is if I am not working on the screen after some time automatically showing “null” in the login user name that I display userName on label

  1. What is the meaning of this Null in login?
  2. How we can avoid this?
  3. Can we make it automatically logout if user is not use the launch screen for sometime or user not use screen for longer duration?

When the username is null it means that there is no user logged in. I usually override null and display something like ‘guest’ instead.

You can set the auto logout from the project properties. Just note that while it will log the user out, the idp may still remember the login and clicking login again will then auto login the last user. You can avoid that by setting an option I believe in the idp settings, I can’t remember off the top of my head

Hello,
Can anyone help me to resolve this null login issue…

I believe @nminchin did. If that didn’t solve your problem, you might want to say why, so that we know what to work with.

Hello,
Did not solve my problem,
I can access all screen component on launch window but still login showing user name as null. so can we make automatic logout after some time if user is not use the launch screen

If the user is null, there’s no logout to do. You should be inspecting your page and view designs to ensure you’ve required security where you need it. Perspective allows anonymous users unless you add restrictions.

If you don’t want users to have access to your app at all without logging in, use the project properties to deny unauthenticated access. Otherwise, do as Phil said and disable actions on your View components based on roles/etc for example using the hasRole(...) function

image