Archive: Username Password +More


Username Password +More
Hello,

I know there is code out there for a username and password.. I have found a few on this board.
Is this possible. I have 3 different programs I want installed. User1 enters username1 password1 can then proceed to install program1, user2 enters username2 and password2 can install program2, user3 enters username3 and password3 can then proceed to install program3. I could make 3 different installers and 3 different discs, but that's not what I really want. If someoen could modify the code below and repost it. That would be greatly appreciated by myself and anyone else who can use it

Thanks in advance

[edit]edited by kichik. please don't paste in huge scripts. script in question can be found @ http://nsis.sourceforge.net/archive/...instances=0,64[/edit]


Why can't you just do what you have there, but just extract different files depending on the entered password / user name.

-Stu


You can save a value to a variable and use it to install different files in the section.


Can you do this?
Joost could you modify your code so it would do this? I am not that well versed in nsi scripts.


Please and Thank You


Just what you did in the page function, you can also put that in a section (read the INI file again or store the values in a variable).


Joost I need your help
Joost I am really new to programming and scripting.. I could really use your help on howto figure out how to get these into a variable and how each can call their own files to install... I am hoping to study and learn off what you have done, but I just don't have the knowledge to continue from here..

Can you please help me...


Thanks


Ken


Can anyone help me!
Can someone please help me. I am new to programming and scripting.


Check 'Examples\Modern UI\InstallOptions.nsi' or 'Contrib\InstallOptions\test.nsi', they use the input of a custom page.


Here's a way of doing it, but I'd prefer being able to do it by turning sections on and off (yet still have them invisible) rather than testing a variable in each section. Still, it seems to work okay.

(Note: it's a variation on the script KiCHiK linked to at the top of this page, so it needs the .ini file that goes with that script, follow his link to find the ini file)


Sunjammer, in the latest CVS version (maybe even b3, I don't remember right now) you can unselect hidden sections so they won't get executed. I have attached a small example script.


Yeah, I've just never played with that stuff, and figured any kind of solution would be of interest to KHolmes. I was actually going to hold back but then thought "hmm he/she's been waiting for a while already" ... :D


Works, but doesn't do what I want
I can get it to run, but it let's user2 install user1's file etc... I don't want user2 to be able to choose user1's file just their own file.
This is what I have.. Is what I am asking possible?

Section "user1" user1
DetailPrint "user1 section"
StrCmp $R9 "user1" 0
DetailPrint "install files"
SetOutPath "$INSTDIR"
File /r "file1.exe"
CreateShortCut "$DESKTOP\$File.lnk" "$INSTDIR\$File.*" ""
skip:
SectionEnd

Section "user2" user2
DetailPrint "user2 section"
StrCmp $R9 "user2" 0 skip
DetailPrint "install files"
SetOutPath "$INSTDIR"
File /r "user2.exe"
CreateShortCut "$DESKTOP\$File.lnk" "$INSTDIR\$File.*" ""
skip:
SectionEnd

Section "user3" user3
DetailPrint "user3 section"
StrCmp $R9 "user3" 0 skip
DetailPrint "install files"
SetOutPath "$INSTDIR"
File /r "user3.exe"
CreateShortCut "$DESKTOP\$File.lnk" "$INSTDIR\$File.*" ""
skip:
SectionEnd


Anyone got any ideas?

Thanks


I don't understand, it works fine for me. If I "login" as user2 then the only files it installs are the files in the section for user2. The DetailPrint output shows on my screen :-

User name: user2
Password: user2 password
user1 section
user2 section
install files
Extract: NSIS.exe
user3 section
Completed

Now obviously I just set some arbitrary files to install but nsis.exe was the file for user2, it didn't install any of the files I had in the other sections so what is it that doesn't work for you?

Put back the minuses before the section name. If the name is "-user1" the section won't show as a component on the components page and the user won't be able to deselect it, although it will still not install because of the check.


Ahha I didn't spot that, nice one KiCHiK.


Got it to work
OK I got it to work...
Thanks for all your guys' help.. I really appreciate it..

Here is the modified version for anyone who is new to NSI. I added a few more comments for the ultra newb like myself..

The up.ini file can be found at the link that Kichik added above.


Thanks again everyone


P.S. If you use this
If you use this script post a reply here. It's always nice to give a kudos to the people who wrote it.


Just a quick question. How do you get rid of the prompt that comes up that gives you the username and password?

Never mind.. I opened my eyes and saw this
MessageBox MB_OK "user [$0] pass [$1]"


I think because is:


MessageBox MB_OK "user $0 pass $1"
; change this line in your script