コード例 #1
0
    def update(cls, username, password):
        # @TODO could be problem
        username = str(username)
        password = str(password)

        u = UserDB(app.config.get('USER_DB_FILE'))
        return u.set(username, password)
コード例 #2
0
ファイル: user.py プロジェクト: benjwadams/glider-dac
    def update(cls, username, password):
        # @TODO could be problem
        username = str(username)
        password = str(password)

        u = UserDB(app.config.get('USER_DB_FILE'))
        return u.set(username, password)
コード例 #3
0
ファイル: usertool.py プロジェクト: benjwadams/glider-dac
    parser.add_argument('db_file', help='Path to the BDB user file')
    parser.add_argument('op', choices=['set', 'list', 'check', 'init'], help='"set" a user\'s password, "check" a user\'s password, "list" all known users')
    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
ファイル: user.py プロジェクト: leilabbb/glider-dac
 def update(cls, username, password):
     u = UserDB(app.config.get('USER_DB_FILE'))
     return u.set(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)