Exemplo n.º 1
0
 def post(self):
     my_user, my_profile = force_signup(self)
     if not my_profile:
         my_profile = Profile()
     my_nickname = self.request.get('nickname')
     my_profile.nickname = my_nickname
     my_profile.user_id = my_user.user_id()
     my_profile.put()
     time.sleep(0.1)
     self.redirect('/')
Exemplo n.º 2
0
#!/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"})
Exemplo n.º 3
0
#!/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"})