diff --git a/daemon.py b/daemon.py index c5a81572..8e4ba1d1 100644 --- a/daemon.py +++ b/daemon.py @@ -164,6 +164,7 @@ from shares import getSharesFeedForPerson from shares import addShare from shares import removeShare from shares import expireShares +from utils import isSystemAccount from utils import setConfigParam from utils import getConfigParam from utils import removeIdEnding @@ -1240,8 +1241,9 @@ class PubServer(BaseHTTPRequestHandler): loginNickname, loginPassword, register = \ htmlGetLoginCredentials(loginParams, self.server.lastLoginTime) if loginNickname: - if loginNickname == 'news' or loginNickname == 'inbox': - print('Invalid username login: ' + loginNickname) + if isSystemAccount(loginNickname): + print('Invalid username login: ' + loginNickname + + ' (system account)') self._clearLoginDetails(loginNickname, callingDomain) self.server.POSTbusy = False return diff --git a/utils.py b/utils.py index da689e60..424353fa 100644 --- a/utils.py +++ b/utils.py @@ -19,6 +19,14 @@ from calendar import monthrange from followingCalendar import addPersonToCalendar +def isSystemAccount(nickname: str) -> bool: + """Returns true if the given nickname is a system account + """ + if nickname == 'news' or nickname == 'inbox': + return True + return False + + def createConfig(baseDir: str) -> None: """Creates a configuration file """ diff --git a/webinterface.py b/webinterface.py index 8949fdc6..3c1a8c60 100644 --- a/webinterface.py +++ b/webinterface.py @@ -25,6 +25,7 @@ from ssb import getSSBAddress from tox import getToxAddress from matrix import getMatrixAddress from donate import getDonationUrl +from utils import isSystemAccount from utils import removeIdEnding from utils import getProtocolPrefixes from utils import searchBoxPosts @@ -3224,14 +3225,6 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int, return timelineStr -def isSystemAccount(nickname: str) -> bool: - """Returns true if the given nickname is a system account - """ - if nickname == 'news' or nickname == 'inbox': - return True - return False - - def htmlProfile(defaultTimeline: str, recentPostsCache: {}, maxRecentPosts: int, translate: {}, projectVersion: str,