Example #1
0
    def post(self):
        login_type = self.get_argument("login_type","")
        if not login_type:
            return None
        else:
            login_type = int(login_type)
        res ={}
        if login_type == login_type_dict.get("PASSWORD_LOGIN"):
            login_name = self.get_argument('loginname',"")
            password = self.get_argument("password","")
            res = judge_user_login(login_name,password,login_type)
        elif login_type == login_type_dict.get("SHORT_MESSAGE_LOGIN"):
            phone_number = self.get_argument("phone","")
            message_number = self.get_argument("message","")
            res = judge_user_login(phone_number,message_number,login_type)
        elif login_type ==login_type_dict.get( "THIRD_PART_LOGIN"):
            msg = u"使用第三方登陆"

        if res and res['code'] != "100001":
            print res
            return 404
        elif res and res["code"] == "100001":
            print res
            data = res
            self.render("homepage.html",data=data)
        else:
            print "no res!!!"
            return None
Example #2
0
def judge_user_login(name,passwd,type):
    res ={
        "code":"100002",
        "user_id":-1,
        "token":"",
    }
    if type == login_type_dict.get("PASSWORD_LOGIN"):
        if name and passwd:
            code = "100001"
            user_id = "1"
            token = "login_success_token"
            res.update({
                "code":code,
                "user_id":user_id,
                "token":token,
            })
    return res
Example #3
0
 def get(self):
     login_type = self.get_argument("login_type",login_type_dict.get("PASSWORD_LOGIN"))
     data = {"login_type":login_type}
     self.render("login.html",data=data)