コード例 #1
0
ファイル: tracker.py プロジェクト: kw1jjang/CalVoD
 def POST(self):
     ##
     #if web.data() != {}:
      #   pdb.set_trace()
     #    data = web.data()
     #    data = json.loads(data)
     #    user_name = data['inputUserName']
     #    password = data['inputPassword']
         #This if statement must be before the web.input() statement.
     if web.input() != {}:
         data = web.input()
         user_name = data.inputUserName
         password = data.inputPassword
     if len(db_manager.get_account(user_name)) == 0:
         session.login = False
         #return "user does not exist!"
         raise web.seeother('/login')
     elif db_manager.get_account(user_name)[0].password == password:
         session.login = True
         session.user_name= user_name
         
         if session.user_name == 'admin':
             raise web.seeother('/')
         else:
             raise web.seeother('/user_overview')
     elif db_manager.get_account(user_name)[0].password != password:
         session.login = False
         #return "wrong username/password combination!"
         raise web.seeother('/login')
コード例 #2
0
ファイル: tracker.py プロジェクト: kw1jjang/CalVoD
 def POST(self):
     data = web.input() #when not setting ('Content-Type', application/json')
     #data = web.data() from urllib2 sending as json
     user_name = data.inputUserName
     password = data.inputPassword
     email_address = data.inputEmail
     if len(db_manager.get_account(user_name)) == 0:
         db_manager.add_account(user_name, password, email_address)
         db_manager.add_account_to_points_table(user_name)
         session.login = True
         session.user_name= user_name
         raise web.seeother('/user_overview')
     else:
         #raise web.seeother('/signup')
         session.login = False
         return "User name already exist! Login or register with another user name!"