Problem with a script

Good morning!
I have a little doubt, I have a script that in parameters asks for user and password with zenity, and I am trying that with those parameters a su will be made and change user without asking for a password since it was previously entered as a parameter
I attached the work done, I hope you can help me.
Thank you in advance

Please provide full system details of your operation system, versions, etc.

Thanks.

I have had some success with prompting for the password (without username) from sudo like this:

$ cat /usr/local/bin/zenity_passphrase
#!/bin/bash
zenity --password --title="sudo password prompt" --timeout=10
$ export SUDO_ASKPASS=/usr/local/bin/zenity_passphrase
$ sudo -A id
<GUI prompt for password>
uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
$