Ejemplo n.º 1
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.º 2
0
    def post(self):
        the_post = Post()
        username = the_post.get_username(self)
        password = the_post.get_password(self)
        cellphone = the_post.get_cellphone_number(self)
        country_code = the_post.get_country_code(self)
        instance = Staff(username)

        result = instance.add_staff(password, cellphone, country_code)
        if result:
            return self.redirect(MANAGEMENT_STAFF_LIST_URL)
        return self.redirect(MANAGEMENT_STAFF_ADD_HTML)
Ejemplo n.º 3
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.º 4
0
    def post(self):
        the_post = Post()
        country_name = the_post.get_name(self)
        country_code = the_post.get_country_code(self)
        instance = CountryCode()
        if country_name and country_code:
            if not str(country_code).strip().startswith("+"):
                country_code = "+" + str(country_code).strip()
            data = dict()
            data["country_name"] = country_name
            data["country_code"] = country_code
            success = instance.add(data)
            if success:
                return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_LIST_URL)

        return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_ADD_URL)
Ejemplo n.º 5
0
    def post(self):
        the_post = Post()
        staff_id = the_post.get_staff_id(self)
        username = the_post.get_username(self)
        country_code = the_post.get_country_code(self)
        cellphone = the_post.get_cellphone_number(self)
        submit = the_post.get_submit(self)

        instance = Staff()
        staff = instance.get_by_id(staff_id)
        detail_url = MANAGEMENT_STAFF_DETAIL_HTML + "?staff_id=" + str(
            staff_id)
        if submit:
            data = dict()
            data["username"] = username
            data["country_code_id"] = country_code
            data["cellphone"] = cellphone
            success = instance.update_staff(staff, data)
            if success:
                return self.redirect(MANAGEMENT_STAFF_LIST_URL)

        return self.redirect(detail_url)
Ejemplo n.º 6
0
    def post(self):
        the_post = Post()
        country_code_id = the_post.get_id(self)
        country_name = the_post.get_name(self)
        country_code = the_post.get_country_code(self)
        instance = CountryCode()
        country_code_obj = instance.get(country_code_id)
        submit = the_post.get_submit(self)
        delete_or_restore = the_post.get_delete_or_restore(self)
        success = False
        if submit:
            data = dict()
            data["country_name"] = country_name
            data["country_code"] = country_code
            success = instance.update(country_code_obj, data)
        if delete_or_restore:
            success = instance.delete(country_code_obj)

        if success:
            return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_LIST_URL)
        return self.redirect(BASE_COUNTRY_CODE_BACKSTAGE_DETAIL_HTML + "?id=" +
                             str(country_code_id))
Ejemplo n.º 7
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="注册不成功")