Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   How to confirm a password (http://forums.winamp.com/showthread.php?t=231588)

M4RC II 21st November 2005 17:17

How to confirm a password
 
1 Attachment(s)
Hy, I have make an password page. The user must enter there a password for his server.

How can I make it, that the user must confirm the password.

If the password isn't the same there must come an message box with the text.

The passwords aren't the same.

If the user hasn't write an password in the confirm field there should be come the message box:

You haven't fill-in the confirm password field.

How can I do this?

Please help me.

Could you write the code in my password.nsh?

Afrow UK 21st November 2005 17:27

code:
Page Custom CustomShow CustomLeave

!define PASS xyz123

LangString BadPass ${LANG_ENGLISH} "Incorrect password!"

Function CustomLeave
ReadINIStr $R0 "$PLUGINSDIR\IOFile.ini" "Field #" "State"
StrCmp $R0 "${PASS}" +3
MessageBox MB_OK|MB_ICONSTOP "$(BadPass)"
Abort
FunctionEnd



Using InstallOptions isn't very secure for passwords because the password that you type will be in the INI file until you close the installer. If you want added security you can use my PassDialog plugin which has a password dialog among others (such as user name and password).

http://nsis.sourceforge.net/File:PassDialog.zip

-Stu

M4RC II 21st November 2005 17:47

Hy thx for your reply but that it isn't what i mean.

Perhaps you can download my password.rar than you can sea it.

The user enter an password and the password will be copy in the (in my example) Example.txt

In my realy installer it is a password for his server. So i would only that he must enter his password and afer this he must confirm his password.

Thx Marc
I hope that you understand my question. (I can't speak very good english)

Afrow UK 21st November 2005 18:07

Why not just have two password boxes on the same dialog?

-Stu

M4RC II 22nd November 2005 14:08

hy I hope I've understood what you've mean. I think that it isn't good only the make an other "password" box. When the user write a wrong password in the second password box it wouldn't be compare with the first password.

Isn't it possible to make it so that when the user must write his password for the game server (so far it is now) and after this he must remember this password in an other password field.

Then it should be check if it are the sames.
Now Advanced replace in file copy the password in the file from the server.

Here is my function code:



code:
Function PasswordPage

!insertmacro MUI_HEADER_TEXT "Configuration" "Please insert an password."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "password.ini"


FunctionEnd

LangString NoPassword ${LANG_ENGLISH} "Please insert an password!"

; Page Leave Feautures
Function PageLeavePassword

!insertmacro MUI_INSTALLOPTIONS_READ $R0 "Password.ini" "Field 1" "State"
${If} $R0 != ""
Push "Passwort" #-- text to be replaced within the " "
Push "$R0" #-- replace with anything within the " "
Push all #-- replace all occurrences
Push all #-- replace all occurrences
Push $INSTDIR\Example.txt #-- file to replace in
Call AdvReplaceInFile #-- Call the Function
${Else}
MessageBox MB_OK|MB_ICONINFORMATION $(NoPassword)
Abort
${EndIf}

FunctionEnd


Afrow UK 22nd November 2005 16:54

"When the user write a wrong password in the second password box it wouldn't be compare with the first password."
Why not? Compare the passwords from the password fields with StrCmp, then if they are the same you only then need to compare one password with the actual server password.

-Stu

M4RC II 22nd November 2005 18:38

hy could you write me the code how i can do this ?

Thx for your help

M4RC II 24th November 2005 16:15

pls help me afrow uk

Could you write me the code which compare the second password with the first ?

Afrow UK 24th November 2005 16:20

Very simple and logical...

code:

Page Custom CustomShow CustomLeave

!define PASS xyz123

LangString PassDoNotMatch ${LANG_ENGLISH} "Passwords do not match!"
LangString BadPass ${LANG_ENGLISH} "Incorrect password!"

Function CustomLeave
ReadINIStr $R0 "$PLUGINSDIR\IOFile.ini" "Field #" "State"
ReadINIStr $R1 "$PLUGINSDIR\IOFile.ini" "Field #+1" "State"
StrCmp $R0 $R1 +3
MessageBox MB_OK|MB_ICONSTOP "$(PassDoNotMatch)"
Abort
StrCmp $R0 "${PASS}" +3
MessageBox MB_OK|MB_ICONSTOP "$(BadPass)"
Abort
FunctionEnd


M4RC II 24th November 2005 18:24

thx it works


All times are GMT. The time now is 05:17.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.