Exemplo n.º 1
0
    if args['password'] is None:
        args['password'] = get_password(verify=check_with_encrypter)

    encrypter = make_encrypter(args['password'])

    if not check_password.check(args['data_dir'], encrypter):
        print 'Password failed'
        sys.exit(1)

    if args['change_password']:
        new_password = get_password(message="New Password: ")
        new_encrypter = make_encrypter(new_password)
        print 'Re-encrypting your keys...'
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME), encrypter, store_text=(not args['no_text']))
        astore.change_password(new_encrypter)
        # delete the old password.digest
        os.remove(os.path.join(args['data_dir'], check_password.DIGEST_NAME))
        check_password.check(args['data_dir'], new_encrypter)
        # don't assume we want the logger to run afterwards
        print 'Exiting...'
        sys.exit(0)

    with context:
        astore = ActivityStore(os.path.join(args['data_dir'], DBNAME), encrypter, store_text=(not args['no_text']))

        try:
            astore.run()
        except SystemExit:
            astore.close()