Пример #1
0
    def _check_login(cls, username, password):
        # @TODO could be problem
        username = str(username)
        password = str(password)

        u = UserDB(app.config.get('USER_DB_FILE'))
        return u.check(username, password)
Пример #2
0
    def _check_login(cls, username, password):
        # @TODO could be problem
        username = str(username)
        password = str(password)

        u = UserDB(app.config.get('USER_DB_FILE'))
        return u.check(username, password)
Пример #3
0
    parser.add_argument('user', nargs='?', action=UserAction, help='Username')

    args = parser.parse_args()

    if not os.path.exists(args.db_file) and not args.op == "init":
        raise StandardError("File %s does not exist. Use %s %s 'init' if you want to create it" % (args.db_file, sys.argv[0], args.db_file))

    u = UserDB(args.db_file)

    if args.op == 'set':
        pw = getpass.getpass()

        u.set(args.user, pw)
    elif args.op == 'check':
        pw = getpass.getpass()

        cv = u.check(args.user, pw)
        if cv:
            print "Success"
        else:
            print "Failure"
            sys.exit(1)

    elif args.op == 'list':
        print "\n".join(u.list_users())

    elif args.op == 'init':
        u.init_db(args.db_file)


Пример #4
0
 def _check_login(cls, username, password):
     u = UserDB(app.config.get('USER_DB_FILE'))
     return u.check(username.encode(), password.encode())
Пример #5
0
    parser.add_argument('user', nargs='?', action=UserAction, help='Username')

    args = parser.parse_args()

    if not os.path.exists(args.db_file) and not args.op == "init":
        raise StandardError(
            "File %s does not exist. Use %s %s 'init' if you want to create it"
            % (args.db_file, sys.argv[0], args.db_file))

    u = UserDB(args.db_file)

    if args.op == 'set':
        pw = getpass.getpass()

        u.set(args.user, pw)
    elif args.op == 'check':
        pw = getpass.getpass()

        cv = u.check(args.user, pw)
        if cv:
            print "Success"
        else:
            print "Failure"
            sys.exit(1)

    elif args.op == 'list':
        print "\n".join(u.list_users())

    elif args.op == 'init':
        u.init_db(args.db_file)