Password protect a tab
-
Hello all!
My application has multiple tabs. some of them, like the "settings" tab should only be available after authentication as administrator.
One way I found is to add a button to the any of the non locked pages, that requires the user to log in. once logged in the disabled tabs get enabled. but I dont like it.
Is there a native way to request username and/or password when trying to access a tab?
Thank you very much!
Best regards
-
Hello all!
My application has multiple tabs. some of them, like the "settings" tab should only be available after authentication as administrator.
One way I found is to add a button to the any of the non locked pages, that requires the user to log in. once logged in the disabled tabs get enabled. but I dont like it.
Is there a native way to request username and/or password when trying to access a tab?
Thank you very much!
Best regards
@Igor86 said in Password protect a tab:
after authentication as administrator
What kind of administrator? An existing user account on the machine where your app is running?
-
nope, its just some sort of authentication to avoid that the average joe can change settings. it does not need to be super secure.. it can even be a hardcoded password written in plain text in the source code, that the user has to type in a password box before he can access it
-
There is no other way than enabling/disabling the tab programmatically.
-
Hi,
Then you should rather have an "advanced" section in your application settings.
Use something like a QStackedWidget and show the "login" button on it and once the correct password is entered, switch to the other view with the settings. You can lock it again when the user changes the view or after a delay.
For the password management, it depends on what level of protection you want to have and the OS you are using.