def access_key_disable_secret(context, request): request.validated = context.properties.copy() crypt_context = request.registry[CRYPT_CONTEXT] new_hash = crypt_context.encrypt('', scheme='unix_disabled') request.validated['secret_access_key_hash'] = new_hash result = item_edit(context, request, render=False) result['secret_access_key'] = None return result
def access_key_reset_secret(context, request): request.validated = context.properties.copy() crypt_context = request.registry[CRYPT_CONTEXT] password = generate_password() new_hash = crypt_context.encrypt(password) request.validated['secret_access_key_hash'] = new_hash result = item_edit(context, request, render=False) result['access_key_id'] = request.validated['access_key_id'] result['secret_access_key'] = password return result