Skip to content

Instantly share code, notes, and snippets.

@jmusic52
Created February 11, 2013 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmusic52/3d097d2aaf57db6800a0 to your computer and use it in GitHub Desktop.
Save jmusic52/3d097d2aaf57db6800a0 to your computer and use it in GitHub Desktop.
'''
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
passwd = 'Password'
def setusrnm():
return raw_input("Please create your username: ")
def setpass():
return gp('Please create your password: ')
#==========================================================================================================================
def main():
usrnm = 'Username'
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