• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sql_manager.register函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sql_manager.register函数的典型用法代码示例。如果您正苦于以下问题:Python register函数的具体用法?Python register怎么用?Python register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了register函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_register

    def test_register(self):
        sql_manager.register('Dinko', '123123')
        hashed_password = sql_manager.hash_password('123123')
        sql_manager.cursor.execute('SELECT Count(*)  FROM clients WHERE username = (?) AND password = (?)', ('Dinko', hashed_password))
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 1)
开发者ID:tblazhev,项目名称:HackBulgaria-Programming101,代码行数:7,代码来源:sql_manager_test.py


示例2: start

    def start(self):
        print(messages.WELCOME_MSG)
        while True:
            command = input("$$$>")

            if command == 'register':
                username = input("Enter your username: ")
                password = input("Enter your password: ")
                try:
                    sql_manager.register(username, password)
                    print(messages.SUCCESSFUL_REG_MSG)
                except PasswordNotStrongError:
                    print(messages.STRONG_PASSWORD_ERROR_MSG)

            elif command == 'login':
                username = input("Enter your username: ")
                password = getpass.getpass("Enter your password: ")
                logged_user = sql_manager.login(username, password)

                if logged_user:
                    self.logged_menu(logged_user)
                else:
                    print(messages.LOGIN_FAIL_MSG)

            elif command == 'help':
                print("login - for logging in!")
                print("register - for creating new account!")
                print("exit - for closing program!")

            elif command == 'exit':
                break
            else:
                print("Not a valid command")
开发者ID:Martin95056,项目名称:HackBulgaria,代码行数:33,代码来源:cli.py


示例3: setUp

 def setUp(self):
     sql_manager.create_clients_table()
     sql_manager.register('Tester', '[email protected]')
     sql_manager.register('Tester_1', '1234Tester_1')
     sql_manager.register('Tester_3', '12345678Qw')
     sql_manager.register('Tester_2', '[email protected]')
     sql_manager.register('Tester_4', '[email protected]')
开发者ID:mimipaskova,项目名称:HackBulgaria-Programming101,代码行数:7,代码来源:sql_manager_test.py


示例4: test_register

    def test_register(self):
        sql_manager.register('Dinko', STRONG_PASSWORD2)

        sql_manager.cursor.execute('SELECT Count(*)  FROM clients WHERE username = (?)', ('Dinko',))
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 1)
开发者ID:Martin95056,项目名称:HackBulgaria,代码行数:7,代码来源:sql_manager_test.py


示例5: main_menu

def main_menu():
    print("Welcome to our bank service. You are not logged in. \nPlease register or login")

    while True:
        command = input("$$$>")

        if command == 'register':
            username = input("Enter your username: ")
            password = valid_password()

            sql_manager.register(username, password)

            print("Registration Successfull")

        elif command == 'login':
            username = input("Enter your username: ")
            password = input("Enter your password: ")

            logged_user = sql_manager.login(username, password)

            if logged_user:
                logged_menu(logged_user)
            else:
                print("Login failed")

        elif command == 'help':
            print("login - for logging in!")
            print("register - for creating new account!")
            print("exit - for closing program!")

        elif command == 'exit':
            break
        else:
            print("Not a valid command")
开发者ID:NikiMaslarski,项目名称:HackBulgari_Programming101,代码行数:34,代码来源:start.py


示例6: test_register

 def test_register(self):
     sql_manager.register('Dinko', '123123', "[email protected]")
     sql_manager.cursor.execute('''SELECT Count(*)  FROM clients
                                 WHERE username = (?)
                                 AND password = (?)''', ('Dinko', '123123'))
     users_count = sql_manager.cursor.fetchone()
     self.assertEqual(users_count[0], 1)
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:7,代码来源:sql_manager_test.py


示例7: test_register

    def test_register(self):
        sql_manager.register('Dinko', 'asdaFGG45g*&')

        sql_manager.cursor.execute('SELECT Count(*)  FROM clients WHERE username = (?) AND password = (?)', ('Dinko', 'asdaFGG45g*&'))
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 1)
开发者ID:nkolchakov,项目名称:Programming101-Python,代码行数:7,代码来源:sql_manager_test.py


示例8: test_change_password_with_sql_injection

    def test_change_password_with_sql_injection(self):
        sql_manager.register('Dinko', STRONG_PASSWORD1)
        sql_manager.register('Vladko', STRONG_PASSWORD2)

        logged_user = sql_manager.login('Dinko', STRONG_PASSWORD1)
        new_password = "1234Asdf$$$Asdf' WHERE id = 3 --"
        sql_manager.change_pass(new_password, logged_user)
        self.assertFalse(sql_manager.login('Vladko', "1234Asdf$$$Asdf"))
开发者ID:Martin95056,项目名称:HackBulgaria,代码行数:8,代码来源:sql_manager_test.py


示例9: test_register

    def test_register(self):
        sql_manager.register('Dinko', '$$$$Dim_4o')

        sql_manager.cursor.execute(
            '''SELECT Count(*)  FROM clients WHERE username = ? AND password = ?''', ('Dinko', '$$$$Dim_4o'))
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 1)
开发者ID:VasilVasilev93,项目名称:HackBulgaria,代码行数:8,代码来源:sql_manager_test.py


示例10: test_register_with_username_not_including_upper_lower_digit_special

    def test_register_with_username_not_including_upper_lower_digit_special(self):
        sql_manager.register('Dinko', 'palachinkooooo!!!')

        sql_manager.cursor.execute(
            '''SELECT Count(*)  FROM clients WHERE username = ? AND password = ?''', ('Dinko', 'Dinko_23Lopatata$!!!'))
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 0)
开发者ID:VasilVasilev93,项目名称:HackBulgaria,代码行数:8,代码来源:sql_manager_test.py


示例11: register

def register():
    username = input("Enter your username: ")
    password = input("Enter your password: ")
    try:
        sql_manager.register(username, password)
        return "Registration siccessfull"
    except StrongPasswordException as e:
        print(e)
开发者ID:whisper95,项目名称:Programming-with-python-101,代码行数:8,代码来源:start.py


示例12: main_menu

def main_menu():
    failed_log_users = [1]
    fail_log_counter = 0
    wrong_pass_limit = 5
    block_message = "you have 5 wrong password inputs\
                    \n and you`re blocked for 5 minutes"

    print("Welcome to our bank service. You are not logged in.\
          \nPlease register or login")

    while True:
        command = input("$$$>")
        if command == 'register':
            username = input("Enter your username: ")
            password = pass_conditions(username)
            hashed_pass = hash_password(password)
            email = input("Enter your emal: ")
            sql_manager.register(username, hashed_pass, email)

            print("Registration Successfull")

        elif command == 'login':
            username = input("Enter your username: ")
            password = getpass.getpass('Password:')
            input_pass = hash_password(password)

            logged_user = sql_manager.login(username)
            existing_pass = sql_manager.get_user_pass(username)
            is_pass_eq = sql_manager.check_password(input_pass, existing_pass) is True
            if logged_user and is_pass_eq and can_login(username) is True:
                fail_log_counter = 0
                sql_manager.unbclock_user(username)
                logged_menu(logged_user)
                failed_log_users = [1]
            else:
                print("Login failed")
                last_user = failed_log_users[len(failed_log_users) - 1]
                if fail_log_counter >= wrong_pass_limit:
                    print(block_message)
                if username == last_user:
                    fail_log_counter += 1
                    if fail_log_counter == wrong_pass_limit:
                        sql_manager.block_user(username)
                        fail_log_counter = 0
                        print(block_message)
                else:
                    fail_log_counter = 1
                failed_log_users.append(username)

        elif command == 'help':
            print("login - for logging in!")
            print("register - for creating new account!")
            print("exit - for closing program!")

        elif command == 'exit':
            break
        else:
            print("Not a valid command")
开发者ID:mihail-nikolov,项目名称:hackBG,代码行数:58,代码来源:start.py


示例13: test_hash

    def test_hash(self):
        username = 'tdhris'
        password = 'blahblahblah'
        sql_manager.register(username, password)

        sql_manager.cursor.execute("SELECT Count(*) FROM clients\
            WHERE username = ? AND password = ?", (username, password))

        self.assertEqual(0, sql_manager.cursor.fetchone()[0])
开发者ID:tdhris,项目名称:HackBulgaria,代码行数:9,代码来源:sql_manager_test.py


示例14: main_menu

def main_menu():
    print("Welcome to our bank service. You are not logged in. \nPlease register or login")

    while True:
        command = input("$$$>").split(" ")

        if command[0] == 'register':
            username = input("Enter your username: ")
            password = getpass.getpass("Enter your password: ")
            while not sql_manager.is_strong(username, password):
                print("Password is not strong enough!")
                password = getpass.getpass("Enter your password: ")
            email = input("Enter your email: ")
            sql_manager.register(username, password, email)

            print("Registration Successfull")

        elif command[0] == 'login':
            username = input("Enter your username: ")
            password = getpass.getpass("Enter your password: ")

            logged_user = sql_manager.login(username, password)

            if logged_user:
                logged_menu(logged_user)
            else:
                print("Login failed")

        elif command[0] == "reset-password" and len(command) >1:
            reset_hash = hashlib.sha1(str(random.random()).encode()).hexdigest()
            sql_manager.update_reset_hash(command[1], reset_hash)
            send_email.send_email(sql_manager.get_email(command[1]), reset_hash)
            print(command[1])


        elif command[0] == "send-reset-password" and len(command) > 1:
            reset_hash = input("Enter reset hash: ")
            if reset_hash == sql_manager.get_reset_hash(command[1]):
                logged_user = sql_manager.login_with_hash(command[1], reset_hash)
                if logged_user:
                    logged_menu(logged_user)
                else:
                    print("Login failed")


        elif command[0] == 'help':
            print("login - for logging in!")
            print("register - for creating new account!")
            print("exit - for closing program!")
            print("reset-password <name> - to reset password")
            print("send-reset-password <name> - to enter reset password")

        elif command[0] == 'exit':
            break
        else:
            print("Not a valid command")
开发者ID:nkgeorgiev,项目名称:HackBulgaria---Programming101---2,代码行数:56,代码来源:start.py


示例15: test_register

    def test_register(self):
        sql_manager.register('Dinko', '123123', '[email protected]',)

        sql_manager.cursor.execute(
            'SELECT Count(*)  FROM clients WHERE username = (?) AND password = (?)',
            ('Dinko', '123123')
        )
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 1)
开发者ID:Dayana-Marinova,项目名称:HackBulgariaHomework,代码行数:10,代码来源:sql_manager_test.py


示例16: register

def register():
    username = input("Enter your username: ")
    password = getpass.getpass('Enter your password:')

    valid_password = ValidateRegistration(username, password)
    is_valid = valid_password.is_valid()

    if is_valid is True:
        sql_manager.register(username, password)
        print("Registration Successfull")
    else:
        print(is_valid)
开发者ID:ivannborisov,项目名称:Programming-101-v3,代码行数:12,代码来源:start.py


示例17: test_register

    def test_register(self):
        username = 'Dinko'
        password = '123123$$GGhhhh'
        hashed_pass = sql_manager.hash_function(password)
        sql_manager.register(username, password)

        sql_manager.cursor.execute('SELECT Count(*)  FROM clients\
            WHERE username = (?) AND password = (?)', (username,
                                                       hashed_pass))
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 1)
开发者ID:tdhris,项目名称:HackBulgaria,代码行数:12,代码来源:sql_manager_test.py


示例18: main_menu

def main_menu():
    print("Welcome to our bank service. You are not logged in. \nPlease register or login")

    while True:
        command = input("$$$>")
        command_array = command.split(" ")
        if command == 'register':
            username = input("Enter your username: ")
            email = input('Enter your email: ')
            while True:
                password = getpass.getpass()
                if len(password) < 8:
                    print("Your Pasword is to short, it must be 8 symbols")
                elif not have_upper_letters(password):
                    print("Your password must have upper letters")
                elif not number_function(password):
                    print("Your password must have numbers")
                elif not have_special(password):
                    print("It must have special symbols")
                elif username in password:
                    print("Don`t use your name in your password")
                else:
                    sql_manager.register(username, sql_manager.get_crypted(password), email)
                    break
            print("Registration Successfull")

        elif command == 'login':
            username = input("Enter your username: ")

            logged_user = sql_manager.login(username, sql_manager.wrong_password_count(username))

            if logged_user:
                logged_menu(logged_user)
            else:
                print("Login failed")

        elif command == 'send-reset-password':
            username = input("Enter your username: ")
            print(sql_manager.send_reset_password(username))

        elif command_array[0] == 'reset-password':
            print(sql_manager.reset_password(command_array[1]))

        elif command == 'help':
            print("login - for logging in!")
            print("register - for creating new account!")
            print("exit - for closing program!")

        elif command == 'exit':
            break
        else:
            print("Not a valid command")
开发者ID:Dayana-Marinova,项目名称:HackBulgariaHomework,代码行数:52,代码来源:start.py


示例19: test_register

    def test_register(self):
        sql_manager.register('Dinko', '123aB#23123', '[email protected]')
        m = hashlib.sha1()
        passw = '123aB#23123'
        m.update(passw.encode('utf-8'))
        passw = m.hexdigest()

        sql_manager.cursor.execute('''SELECT Count(*)  FROM clients
                                      WHERE username = (?)
                                      AND password = (?)''', ('Dinko', passw))
        users_count = sql_manager.cursor.fetchone()

        self.assertEqual(users_count[0], 1)
开发者ID:EmilianStankov,项目名称:Money-In-The-Bank,代码行数:13,代码来源:sql_manager_test.py


示例20: main_menu

def main_menu():
    print("Welcome to our bank service. You are not logged in.")
    print("Please register or login")

    while True:
        command = input("$$$>")

        if command == "register":
            username = input("Enter your username: ")
            password = getpass.getpass("Enter your password: ")
            email = input("Enter your email: ")

            sql_manager.register(username, password, email)

        elif command == "login":
            username = input("Enter your username: ")
            password = getpass.getpass("Enter your password: ")

            logged_user = sql_manager.login(username, password)

            if logged_user:
                logged_menu(logged_user)
            else:
                print("Login failed")

        elif command == "send-reset-password":
            username = input("Enter your username: ")
            sql_manager.send_reset_pass_email(username)

        elif command == "reset-password":
            username = input("Enter your username: ")
            hash = input("Enter the hash code from your email: ")
            sql_manager.reset_password(username, hash)

        elif command == "help":
            print("login - for logging in!")
            print("register - for creating new account!")
            print("send-reset-password - to send a " "password reset code to your email!")
            print(
                "reset-password - to reset your password using a "
                "code from your email, to get it use the command above!"
            )
            print("exit - for closing the program!")

        elif command == "exit":
            break

        else:
            print("Not a valid command")
开发者ID:EmilianStankov,项目名称:Money-In-The-Bank,代码行数:49,代码来源:start.py



注:本文中的sql_manager.register函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sql_select.SqlSelect类代码示例发布时间:2022-05-27
下一篇:
Python sql_manager.login函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap