#!/usr/bin/python import cgi, LINK_HEADERS, sys, json sys.path.insert(0, str(LINK_HEADERS.DATABASE_LINK)) from database_class import DB sys.path.insert(0, str(LINK_HEADERS.MODELS_LINK)) from profile_model import Profile sys.path.insert(0, str(LINK_HEADERS.DAO_LINK)) sys.path.insert(0, str(LINK_HEADERS.SERVICE_LINK)) from login_dao import Login_dao from auth_service import Auth print "Content-Type: text/html\r\n\r\n" form = cgi.FieldStorage() username = str(form.getvalue("username")) passcode = str(form.getvalue("passcode")) first_name = str(form.getvalue("first_name")) last_name = str(form.getvalue("last_name")) profile = Profile(username, passcode, first_name, last_name) if (Auth().verify(username, passcode) == "False"): #If authorization failed, we do not update the user info print json.dumps({"status": "Fail"}) else: #update information Login_dao().update_user(profile) print json.dumps({"status": "Success"})
sys.path.insert(0, str(LINK_HEADERS.SERVICE_LINK)) from login_dao import Login_dao from auth_service import Auth from user_stock_value_dao import User_stock_value_dao from user_portfolio_dao import User_portfolio_dao print "Content-Type: text/html\r\n\r\n" form = cgi.FieldStorage() username = str(form.getvalue("username")) passcode = str(form.getvalue("passcode")) first_name = str(form.getvalue("first_name")) last_name = str(form.getvalue("last_name")) profile = Profile(username, passcode, first_name, last_name) login_dao = Login_dao() try: login_dao.create_user(profile) #Verifying to see if the injection was successfuly if (Auth().verify(username, passcode) == "False"): print json.dumps({"status": "Fail"}) else: User_portfolio_dao().insert(username, 0, 0, 0) User_stock_value_dao().insert(username, 0, 0) print json.dumps({"status": "Success"}) except: print json.dumps({"status": "Fail"})
def __init__(self): self.login_dao = Login_dao()
#!/usr/bin/python import cgi, LINK_HEADERS, sys, json sys.path.insert(0, str(LINK_HEADERS.DATABASE_LINK)) from database_class import DB sys.path.insert(0, str(LINK_HEADERS.MODELS_LINK)) from profile_model import Profile sys.path.insert(0, str(LINK_HEADERS.DAO_LINK)) sys.path.insert(0, str(LINK_HEADERS.SERVICE_LINK)) from login_dao import Login_dao from auth_service import Auth print "Content-Type: text/html\r\n\r\n" form = cgi.FieldStorage() username = str(form.getvalue("username")) old_passcode = str(form.getvalue("old_passcode")) new_passcode = str(form.getvalue("new_passcode")) verify_passcode = str(form.getvalue("verify_passcode")) profile = Profile(username, new_passcode, "", "") profile.prepare() if (Auth().verify(username, old_passcode) == "False"): print json.dumps({"status": "Fail"}) else: Login_dao().update_passcode(profile) print json.dumps({"status": "Success"})