Archive: Password


Password
  Can anyone help me to make a script

"when executing the compiled exe he ask for a pasword and only after the right password executes the installing after 3 times try it quits"


You should use Install Options to create a custom dialog to ask the user for a password. There is a readme for IO in Contrib\InstallOptions\Readme.html. If the user got the password wrong, create the page again and a label to the INI file saying the password was wrong. If the user gets it wrong the third time use Quit to quit the installer.


Can you help me write a script, not yet versed with nsis script yet.
If possible comment the example script.

* - Is this the only option to do it Install Options.
* - Are there online(live)websites for example scripts if not i am in
the process of setting up a site with examples scripts, do you
know any sites were i can setup a link to scripts.


You can either use InstallOptions or write your own plug-in. I think using InstallOptions is much easier don't you agree? :P

There is an example script that shows an InstallOptions page in Contrib\InstallOptions and Examples\Modern UI\InstallOptions.nsi for InstallOptions with the Modern UI. All you need to change is the INI file from TYPE=Text to TYPE=Password.

The old examples page was Sunjammer's NSIS Archive, it was closed but we (mostly Sunjammer) are working on a new archive that will be much more easier to use, contribute to and maintain. There will be a message on the forums when it's ready and probably on http://nsis.sf.net/ too.


The Archive
  I'm putting starting content together for it at the moment (and continuing to add features and get it working properly) ... I'm weeding through the old Sunjammer's NSIS Archive content trying to determine what's worth keeping as we speak (or write).

I'll try and see what I can find that is good for InstallOptions, maybe I'll just write some new content for that :)

Hopefully the archive will be active soon and then the more contributors the merrier, especially since I'll be back at work as of Thursday this week and we've got New Year before then too!!!

X


There is an example script that shows an InstallOptions page in Contrib\InstallOptions and Examples\Modern UI\InstallOptions.nsi for InstallOptions with the Modern UI. All you need to change is the INI file from TYPE=Text to TYPE=Password.

Still not understanding this. please please pretty please help me with an example script.


Enjoy.


Variables
  Can you make it so that i just have to change these lines

user = nsis
pass = kickass

where by i only have to change variables user and pass, i tried did not find variable for the password.

Thanx



  StrCmp $0 "user1" 0 +2

StrCmp$1 "user1 password" continue wrong
StrCmp$0 "user2" 0 +2
StrCmp$1 "user2 password" continue wrong
StrCmp$0 "user3" 0 +2
StrCmp$1 "user3 password" continue wrong
>
That's all you need to change. Every two lines represent the user name (user1, user2, user3) and the password (user1 password, etc.).

Why the line "Read INI file"
  After compiling i see by component install a checkbox with line "Read INI file" i send the script with exe along.

Tankx


That's the section name...


i know
  can i put these lines

Section "Read INI file"
ReadINIStr ${TEMP1} "$TEMP\temp.ini" "Field 1" "State"
DetailPrint "User name: ${TEMP1}"
ReadINIStr ${TEMP1} "$TEMP\temp.ini" "Field 2" "State"
DetailPrint "Password: ${TEMP1}"
SectionEnd

in this

Function .onInit
ReadINIStr ${TEMP1} "$TEMP\temp.ini" "Field 1" "State"
DetailPrint "User name: ${TEMP1}"
ReadINIStr ${TEMP1} "$TEMP\temp.ini" "Field 2" "State"
DetailPrint "Password: ${TEMP1}"
StrCpy $2 0
InitPluginsDir
File /oname=$TEMP\temp.ini "temp.ini"
FunctionEnd


No, you can't put it in .onInit because the user hasn't entered the data yet... .onInit is called when the installer just starts, before any page is shown.


i did
  and try it works, why


Then you must have left some code behind. You can't check the password before the user entered it.


Nope
  You try it, attach all files


Why did you move the INI file to $TEMP? It's supposed to be in $PLUGINSDIR or else it won't be deleted. When you read the username and password from $TEMP you read the username and password from the last installer. You simply can't read the username and password before the user entered them, that's impossible.

The code I gave you already checks if the username and password match according to those StrCmp's you need to change. If you want to later get the username and info you must get it from the INI file AFTER the user has entered them which is impossible in .onInit.