Force User To Prompt

Eskobar
Contributor

Hello,

For time to time we might ask user to prompt his password if no workaround is available depending on scenarios.

When deploying below script, user is not forced to type his password. He can just drag the prompt windows aside and continue working. 

Is there a way to:

1) display the prompt windows on full screen

or/&

2) if not answered, user cannot continue working as per mac software installer "when admin pwd must be put"


#!/bin/bash

 

user=$(ls -l /dev/console | awk '{ print $3 }')
PROMPT_TITLE="Authentication Needed"
Logo="/Users/Shared/loreal.jpeg"

 


echo "Prompting $user for their Mac password..."


USER_PASS=$(sudo -u $user /usr/bin/osascript -e 'display dialog "Please, type your Password to start the xxxx operation:" default answer "" with hidden answer buttons {"OK"} default button 1' -e 'text returned of result')


exit 0

2 REPLIES 2

sdagley
Esteemed Contributor II

@Eskobar Instead of an osascript call you might want to take a look at https://github.com/bartreardon/swiftDialog which you can have display a prompt occupying the full screen.

Agreed, this is the way. There is an option to blur the background and keep the prompt on top. We have moved over to using swiftDialog for all our user interfaces.