On 12/16/2011 05:02 PM, ADRIAN KELLY wrote:
Hi guys,
i created a program that allows users to login using a password that i set at 
the top of the program.
Among other things users are given the option to change their password.  My 
questions is;

Is it possible for me to make this new password stick, in other words when they 
shut down and
log in again i am back to the original password.....the new password only works 
while the programming
is running.  I know why this is happening, what i don't know is what to do 
about it.

I am new to python and programming so if you have any ideas...

please keep them simple.

thanks all,
adrian                                  

Nothing in Python objects is persistent. If you want something to survive till the next run, you have to write it to something external, such as a file.

If this is a serious program, with important passwords, you'll want to encrypt the file. If it's just casual, encode the file in some obscure way. But if it's a class assignment, then save it in a text file, in a directory you'll be able to find next time.

That last point is important. The program directory may be read-only to that user. So you might not be able to store it there. One approach is to save it in the user's home directory, so for me, it might be /home/davea Convention is to start it with a leading period, so that the ls command won't show it by default. Another question is whether you want a different password per user, and if you might have more than one user logged into your machine at the same time.

Hope this helped,







--

DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to