pedroac
3rd August 2006 16:21 UTC
PassDialog: is it possible to change its behaviour?
Hello everybody
From my experience with PassDialog (using a PassDialog::InitDialog, with username and password authentication), I realized that it automatically erases user's password once he/she clicks on next; can I decide when to erase it / or even make it not disappear at all?
Second question: is it possible to give focus to the username field once the user enters the auth page?
Thanks a lot
Afrow UK
3rd August 2006 16:27 UTC
1. Use the /USERTEXT and /PASSTEXT parameters with variables that will store the username and password.
2. System::Call "user32::SetFocus(i $R0, i 0x0007, i,i)i"
where $R0 is the HWND of the box.
-Stu
pedroac
3rd August 2006 16:47 UTC
Still with problems...
I am using this code to make the auth dialog appear:
UserPassPageShow
!insertmacro MUI_HEADER_TEXT "$(msg_auth_enter)" "$(msg_auth_enter_to_continue)."
PassDialog::InitDialog /NOUNLOAD UserPass /HEADINGTEXT $(msg_auth_enter_to_continue2)
/
GROUPTEXT $(msg_auth) /USERTEXT $(msg_auth_username) "$R6" /PASSTEXT $(msg_auth_passwd) "$R7"
Pop $R0 # Page HWND
## Control ID's
!define IDC_USERNAME 1215
!define IDC_PASSWORD 1214
GetDlgItem $R1 $R0${IDC_USERNAME}
SetCtlColors $R1 0x000000 0xFFFFFF
GetDlgItem $R1 $R0${IDC_PASSWORD}
SetCtlColors $R1 0x000000 0xFFFFFF
System::Call "user32::SetFocus(i $R0, i 0x0007, i,i)i"
PassDialog::Show
System::Call "user32::SetFocus(i $R0, i 0x0007, i,i)i"
>FunctionEnd
>
and I use this
UserPassPageLeave
## Pop password & username from stack
Pop $R6
Pop $R7
(...)
>FunctionEnd
>
to get username/password and validate them.
Using the solutions you gave, I noticed no difference:
-the username doesn't get focus on the first time the user accesses auth dialog
-the password is being erased when I return to the auth dialog
Am I doing something wrong?
Afrow UK
3rd August 2006 17:02 UTC
The password will still be cleared when you call Abort in the Leave function. This is by design.
I told you that $R0 in the SetFocus call needed to contain the HWND of the username box.
See attached script.
-Stu
pedroac
3rd August 2006 17:14 UTC
That example had everything i wanted, except for the erase password feature.
Thanks a lot!