-
-
Save jmusic52/3cb39c24898e232c923c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Written By: James Musicant | |
Date: 2/8/2013 | |
Description: Coding for a secure login to Ephillanie. Coding to set the password and username for logging into Ephillanie | |
*uses code from getpass, fileinput, inspect* | |
''' | |
from getpass import getpass as gp | |
import fileinput as fn | |
import inspect as nsp | |
def setusrnm(): | |
return raw_input("Please create your username: ") | |
def setpass(): | |
return gp('Please create your password: ') | |
#========================================================================================================================== | |
def main(): | |
usrnm = '' | |
passwd = '' | |
if usrnm == '': | |
usrnm = setusrnm() | |
line_no = 22 | |
line_val = " usrnm = '" + str(usrnm) + "'" | |
for line in fn.input(files=[nsp.getfile(nsp.currentframe())], inplace=True): | |
if fn.filelineno() == line_no: | |
print line_val | |
else: | |
print line | |
else: | |
print '' | |
if passwd == '': | |
passwd = setpass() | |
line_no = 23 | |
line_val = " passwd = '" + str(passwd) + "'" | |
for line in fn.input(files=[nsp.getfile(nsp.currentframe())], inplace=True): | |
if fn.filelineno() == line_no: | |
print line_val | |
else: | |
print line | |
else: | |
print '' | |
return | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment