Quick background: I had to disable security under Project Properties for perspective so that I could embed Map view inside a vision window using browser module.
I have a view with a button that uses system.perspective.isAuthorized function and if a user is not authorized, brings up the login screen using system.perspective.login(). The user can login and continue onto the Home screen.
Issue: This works perfectly when viewed from a browser but on the app, the default login screen seems to have an X button (Android) and Cancel (iOS) button resp. When I click on this it shows me the Header and Menu (from shared settings) and not my main View with my login button - like Exit Login button.
I believe the exit login functionality was added recently as there was no way for the end user to exit the login page if they had accidently triggered it and navigation was inaccessible (e.g. browser in fullscreen mode, etc.).
I'm not aware of a way to disable it. It may be worth putting in a feature request.
Does this view have security on it?
Would you be able to provide examples of your 'main View' and 'Home Screen' (if they differ) and any snippets of code you think may be helpful. We may be able to come up with a workaround
My main view is my Login screen with a Login button. I also added a continue button for now that shows up only when a user is authenticated. Continue button navigates to my Home screen and there are no events/scripts/security running on that one.
On the login button I have is:
if not system.perspective.isAuthorized(False, ["Authenticated"]):
system.perspective.login()
self.getSibling("Label").props.text = 'Not Auth'
system.perspective.navigate('/Login')
On the Login View’s System events > onStartup I put the following code for testing - My plan was to use the Auth/ Not Auth to hide/show the continue button:
if not system.perspective.isAuthorized(False, ["Authenticated"]):
self.getChild("root").getChild("Label").props.text = 'Not Auth'
else:
self.getChild("root").getChild("Label").props.text = 'Auth'
As a side note you could bind your label’s text property to session.props.auth.authenticated. Nothing wrong with the way you’re doing it, just thought I’d suggest an alternative.