Perspective login screen - get rid of X and Cancel buttons in Android and IOS apps

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.

Is there anyway I can disable this?

Browser:

Android:

After clicking on the X button:

image

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 :slight_smile:

Hi @matthew.ayre - thanks for your reply.

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'

What is the view configured for the Login page?

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.

Thanks @matthew.ayre - I didn’t know that. I’ll use it.

Login page is the default view set to ‘/’.

You are using system.perspective.navigate('/Login'). This Page does not exist.

If you wish to navigate to the view you would need to use system.perspective.navigate(view = 'Main/Login')

If you wish to navigate to the main page you would need to use system.perspective.navigate('/')

:face_with_head_bandage: :face_with_head_bandage: I don’t know how I missed that. I created the view as Login first and decided to change it and totally forgot about it. :expressionless:

1 Like

I feel your pain, I’ve fallen into the same trap many-a-time :sweat_smile:

1 Like