Fix infinite loop when not logged in.

This commit is contained in:
Sijmen 2019-02-05 13:39:50 +01:00
parent 9beae26d0d
commit 71afacbbcb
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import shutil
import textwrap
from commands.login import login
from typing import Any, Callable
from config import Config
@ -25,8 +26,9 @@ def print_wrap(text: str, indent: str = '', end: str = '\n') -> None:
def require_login(function: Callable) -> Callable:
def wrapper(*args: Any, **kwargs: Any) -> Any:
while 'api_token' not in Config['user']:
if 'api_token' not in Config['user']:
print('Not logged in. Please use the login command to log in.')
return
return function(*args, **kwargs)