Verifying Credentials and Roles Within Vision Project

Hi,

I'm working on a project where I would like to verify AD credentials from within a vision project. As an example, every six months a popup would open prompting the technician to perform routine maintenance. Their system would be "locked out" until the maintenance is completed. Essentially, they would check off each item on the list and press a submit button. However, I would like someone assigned a high enough role to have to enter their AD credentials before it will accept it.
I came up with one design for this, but after thinking about it, it seems like it could pose some security risks. Essentially, I had a text field and a password field where they enter their credentials. When they hit submit, a script would check the credentials and role of that user to verify they are authorized to sign off. I wrote the script to see if this would work, and it does, but does Ignition have something built in that would be better? I don't want them to have to log in/out of the project every time.

Here is the script if you'd like to see exactly what I'm doing. This is triggered with the actionPerformed event of my submit button.

username = event.source.parent.getComponent('Text Field').text
password = event.source.parent.getComponent('Password Field').text

validUser = system.security.validateUser(username, password)

if validUser:
	userRoles = system.security.getUserRoles(username, password)

	if 'Facilities' or 'Advanced Techinican' or 'Manager' in roles:
		system.nav.openWindow('Popup Windows/Facility Unlocked')
		system.nav.centerWindow('Popup Windows/Facility Unlocked')
		
	else:
		system.nav.openWindow('Popup Windows/Not Authorized')
		system.nav.centerWindow('Popup Windows/Not Authorized')
		
else:
	system.nav.openWindow('Popup Windows/Invalid Username')
	system.nav.centerWindow('Popup Windows/Invalid Username')

Seems like the intended use of .validateUser().

My concern was with storing the username and password in the variables in the first two lines. Maybe I'm overthinking it, would that pose any type of risk?

Not particularly, no. Do use the password field component for the password, though.

Thanks!