# Opening a popup via script?

**URL:** <https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889>\
**Category:** Ignition\
**Created:** [October 24, 2023, 5:25am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889 "2023-10-24T05:25:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ignitionSL](https://avatars.discourse-cdn.com/v4/letter/i/9e8a1a/32.png) [@ignitionSL](https://forum.inductiveautomation.com/u/ignitionSL)\
**Post date:** [October 24, 2023, 5:25am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/1 "2023-10-24T05:25:24Z")

</div>

How to write a script for a button which open popup window(to enter password) and I need to valid the password and conduct the button action?

---

<div class="post-metadata">

**Author:** ![nideyijuyidong](https://avatars.discourse-cdn.com/v4/letter/n/7cd45c/32.png) [@nideyijuyidong](https://forum.inductiveautomation.com/u/nideyijuyidong)\
**Post date:** [October 24, 2023, 6:14am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/2 "2023-10-24T06:14:02Z")

</div>

Maybe a better way is to configure user permissions for the button event.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/b/8b5a1b69ec6a775752c1eef16302e08f1eddcc98.png)

---

<div class="post-metadata">

**Author:** ![leonardo.godoi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/leonardo.godoi/32/27178_2.png) [@leonardo.godoi](https://forum.inductiveautomation.com/u/leonardo.godoi)\
**Post date:** [October 24, 2023, 12:01pm UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/3 "2023-10-24T12:01:39Z")

</div>

Vision or Perspective?

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [October 24, 2023, 12:06pm UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/4 "2023-10-24T12:06:41Z")

</div>

Sounds like you may want [system.security.validateUser - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.security.validateUser)

Have a popup to get the username / password from the user and this function will check that it's a valid user against a specified user source.

---

<div class="post-metadata">

**Author:** ![Simen\_Minerd](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@Simen\_Minerd](https://forum.inductiveautomation.com/u/Simen_Minerd)\
**Post date:** [October 24, 2023, 1:06pm UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/5 "2023-10-24T13:06:43Z")

</div>

If it is Perspective, maybe it is no a good idea to just set lock the navigation button. If your screen has URL somebody can just type in URL directly. If you do not use URL, other project cannot use navigation button to access your screen, it would be good for integration. You can lock the screen or objects.  
You can enable/disable objects by binding it to user name or user group.

---

<div class="post-metadata">

**Author:** ![ignitionSL](https://avatars.discourse-cdn.com/v4/letter/i/9e8a1a/32.png) [@ignitionSL](https://forum.inductiveautomation.com/u/ignitionSL)\
**Post date:** [October 24, 2023, 9:57pm UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/6 "2023-10-24T21:57:59Z")

</div>

Perspective

---

<div class="post-metadata">

**Author:** ![ignitionSL](https://avatars.discourse-cdn.com/v4/letter/i/9e8a1a/32.png) [@ignitionSL](https://forum.inductiveautomation.com/u/ignitionSL)\
**Post date:** [October 24, 2023, 10:05pm UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/7 "2023-10-24T22:05:17Z")

</div>

How can I pass, the password and UN from popup to script?

---

<div class="post-metadata">

**Author:** ![Chris\_Murphy](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@Chris\_Murphy](https://forum.inductiveautomation.com/u/Chris_Murphy)\
**Post date:** [October 25, 2023, 2:00am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/8 "2023-10-25T02:00:10Z")

</div>

You can use the authentication challenge.  
[system.perspective.authenticationChallenge](https://docs.inductiveautomation.com/display/DOC81/system.perspective.authenticationChallenge)  
This will create a popup for the user to login, then fire a callback with the result for you to do something. You can send a payload of data through with it for context as well.

---

<div class="post-metadata">

**Author:** ![ignitionSL](https://avatars.discourse-cdn.com/v4/letter/i/9e8a1a/32.png) [@ignitionSL](https://forum.inductiveautomation.com/u/ignitionSL)\
**Post date:** [October 25, 2023, 4:14am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/9 "2023-10-25T04:14:57Z")

</div>

> [@Chris\_Murphy](#):
>
> then fire a callback

what is callback? How can I get the feedback of the opened window(login) that created from AthenticationChallenge ?

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [October 25, 2023, 10:56am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/10 "2023-10-25T10:56:58Z")

</div>

Check the manual: [system.perspective.authenticationChallenge - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.perspective.authenticationChallenge)

The session event onAuthenticationChallengeCompleted looks like it is fired when the challenge is complete. [Perspective Session Event Scripts - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Perspective+Session+Event+Scripts#PerspectiveSessionEventScripts-AuthenticationChallengeCompleted)

---

<div class="post-metadata">

**Author:** ![Chris\_Murphy](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@Chris\_Murphy](https://forum.inductiveautomation.com/u/Chris_Murphy)\
**Post date:** [October 31, 2023, 4:20am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/11 "2023-10-31T04:20:53Z")

</div>

@ignitionSL the manual explains how it works.  
As mentioned, there is an event listed in the Perspective session events that will be fired when the user completes the authentication challenge.  
You can use the parameters passed into that method to determine what to do and you can pass some state in the payload when you call the challenge if you need to.  
For example you can check that the credentials used for the challenge belonged to a certain role, like that the user is an administrator.

```auto
def onAuthChallengeCompleted(session, payload, result):
	myData = payload.get('myData', None)
	if result.isSuccess() and myData:
		context = result.getAsSuccess().getContext()
		user = context.user
		if 'Administrators' in user.roles:
			#do something

```

---

<div class="post-metadata">

**Author:** ![ignitionSL](https://avatars.discourse-cdn.com/v4/letter/i/9e8a1a/32.png) [@ignitionSL](https://forum.inductiveautomation.com/u/ignitionSL)\
**Post date:** [October 31, 2023, 5:25am UTC](https://forum.inductiveautomation.com/t/opening-a-popup-via-script/80889/12 "2023-10-31T05:25:45Z")

</div>

[Get embedded login window details in Perspective - Ignition - Inductive Automation Forum](https://forum.inductiveautomation.com/t/get-embedded-login-window-details-in-perspective/80940)
