Ejemplo n.º 1
0
    def post(self):
        OHHOLog.print_log("start register")
        the_post = Post()
        OHHOLog.print_log("set the post")
        self.set_format(the_post.get_format(self))
        username = the_post.get_username(self)
        OHHOLog.print_log("get username")
        password = the_post.get_password(self)
        code = the_post.get_code(self)
        cellphone = the_post.get_cellphone_number(self)
        country_code = the_post.get_cellphone_country_code(self)
        if not country_code:
            country_code = "+86"
        identity_id = the_post.get_device_identity_id(self)
        mac_address = the_post.get_device_mac_address(self)
        imei = the_post.get_imei(self)
        base_url = the_post.get_base_url(self)
        register_dict = dict()

        OHHOLog.print_log("get all parameters")
        register_dict["username"] = username
        register_dict["password"] = password
        register_dict["code"] = code
        register_dict["identity_id"] = identity_id
        register_dict["mac_address"] = mac_address
        register_dict["imei"] = imei
        register_dict["cellphone"] = cellphone
        register_dict["country_code"] = country_code

        cellphone_dict = the_post.get_cellphone(self)
        instance = LogicRegister(register_dict, cellphone_dict)
        result = instance.register(base_url)
        return self.response(result)
Ejemplo n.º 2
0
 def post(self):
     the_post = Post()
     self.set_format(the_post.get_format(self))
     user_id = the_post.get_user_id(self)
     OHHOLog.print_log(user_id)
     cellphone_number = the_post.get_cellphone_number(self)
     code = the_post.get_code(self)
     country_code = the_post.get_country_code(self)
     instance = LogicUpdateCellphoneNumber()
     result = instance.change(user_id, cellphone_number, code, country_code)
     return self.response(result)
Ejemplo n.º 3
0
 def post(self):
     the_post = Post()
     self.set_format(the_post.get_format(self))
     country_code = the_post.get_cellphone_country_code(self)
     cellphone_number = the_post.get_cellphone_number(self)
     code = the_post.get_code(self)
     identity_id = the_post.get_device_identity_id(self)
     mac_address = the_post.get_device_mac_address(self)
     unbind_device = LogicCellphoneUnbindDevice()
     result = unbind_device.unbind_device(cellphone_number, code, identity_id, mac_address, country_code)
     return self.response(result)
Ejemplo n.º 4
0
 def post(self):
     the_post = Post()
     self.set_format(the_post.get_format(self))
     cellphone_number = the_post.get_cellphone_number(self)
     password = the_post.get_password(self)
     code = the_post.get_code(self)
     country_code = the_post.get_country_code(self)
     instance = LogicResetPassword()
     result = instance.reset_password(cellphone_number, password, code, country_code)
     if result.get("code") == 1:
         return self.redirect("/backstage/home/")
     return self.redirect("/backstage/login/")
Ejemplo n.º 5
0
    def post(self):
        the_post = Post()
        self.set_format(the_post.get_format(self))
        username = the_post.get_username(self)
        password = the_post.get_password(self)
        country_code = the_post.get_cellphone_country_code(self)
        cellphone_dict = the_post.get_cellphone(self)
        base_url = the_post.get_base_url(self)
        code = the_post.get_code(self)

        instance = LogicLoginByCode()
        result = instance.authenticate(country_code, username, password,
                                       cellphone_dict, base_url, code)
        return self.response(result)
Ejemplo n.º 6
0
    def post(self):
        the_post = Post()
        self.set_format(the_post.get_format(self))
        country_code = the_post.get_cellphone_country_code(self)
        cellphone_key = the_post.get_cellphone_key(self)
        cellphone_number = the_post.get_cellphone_number(self)
        cellphone_dict = the_post.get_cellphone(self)
        code = the_post.get_code(self)
        base_url = the_post.get_base_url(self)

        instance = LogicRebindCellphone()
        result = instance.rebind_cellphone(cellphone_key, cellphone_number,
                                           code, base_url, cellphone_dict,
                                           country_code)
        return self.response(result)
Ejemplo n.º 7
0
    def post(self):
        the_post = Post()
        self.set_format(the_post.get_format(self))
        cellphone_number = the_post.get_cellphone_number(self)
        password = the_post.get_password(self)
        code = the_post.get_code(self)
        country_code = the_post.get_cellphone_country_code(self)
        cellphone_dict = the_post.get_cellphone(self)
        cellphone_dict = cellphone_dict if cellphone_dict else dict()
        base_url = the_post.get_base_url(self)
        instance = LogicResetPassword()
        result = instance.reset_password(cellphone_number, password, code,
                                         country_code, cellphone_dict,
                                         base_url)

        return self.response(result)
Ejemplo n.º 8
0
    def post(self):
        the_post = Post()
        self.set_format(the_post.get_format(self))
        user_id = the_post.get_user_id(self)
        apply_id = the_post.get_apply_id(self)
        address = the_post.get_map_address(self)
        longitude = the_post.get_map_longitude(self)
        latitude = the_post.get_map_latitude(self)
        name = the_post.get_name(self)
        code = the_post.get_code(self)

        address_dict = dict()
        address_dict["address"] = address
        address_dict["name"] = name
        address_dict["code"] = code
        address_dict["longitude"] = longitude
        address_dict["latitude"] = latitude

        instance = LogicWhereMeet()
        result = instance.where_meet(user_id, apply_id, address_dict)
        return self.response(result)
Ejemplo n.º 9
0
    def post(self):
        user = User()
        the_post = Post()
        country_code = the_post.get_country_code(self)
        cellphone = the_post.get_username(self)
        password = the_post.get_password(self)
        code = the_post.get_code(self)
        instance = LogicBackstageRegister()
        register_instance = LogicRegister()
        msg = ""
        country_code_object = user.get_country_code(country_code)
        if country_code_object and not user.get_by_country_code_and_cellphone(
                country_code_object.id, cellphone):
            register_result = register_instance.add_new_user(
                password, cellphone, country_code)
            OHHOLog.print_log(register_result)
            if Result.is_success(register_result):
                user_id = register_result.get("user_id", 0)

                user_object = user.get_by_id(user_id)
                if user_object:
                    self.set_secure_cookie("username", user_object.username)
                    return self.redirect("/backstage/home/")
        # if Code.check_code(username, code):  # 目前验证码没有用,先注释掉
        #     pass
        # else:
        #     return self.render(BACKSTAGE_REGISTER_HTML,
        #                        postUrl=BACKSTAGE_REGISTER_URL,
        #                        msg="验证码不正确"
        #                        )
        # if username and password:
        #     result1 = instance.register(username, password)
        #     if result1:
        #         self.set_secure_cookie("username", username)
        #         return self.redirect("/backstage/home/")
        return self.render(BACKSTAGE_REGISTER_HTML,
                           postUrl=BACKSTAGE_REGISTER_URL,
                           msg="注册不成功")