This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
yubi-lock/yubi_lock/api/user.py

17 lines
390 B
Python
Raw Normal View History

2016-05-19 21:32:01 +01:00
import os, pwd, json
from yubi_lock.api import BASE_DIR
def get_username():
return pwd.getpwuid(os.getuid())[0]
def store_key(ident):
with open(os.path.join(BASE_DIR, "data/keys.json")) as file:
existing_data = json.load(file)
existing_data.append(ident)
with open(os.path.join(BASE_DIR, "data/keys.json"), 'w') as file:
json.dump(existing_data, file)