Regenerate account info screen

merge-requests/8/head
Bob Mottram 2020-12-10 10:21:54 +00:00
parent b762300c81
commit 3aa245d5b9
2 changed files with 43 additions and 24 deletions

View File

@ -8132,10 +8132,6 @@ class PubServer(BaseHTTPRequestHandler):
fullWidthTimelineButtonHeader = \ fullWidthTimelineButtonHeader = \
self.server.fullWidthTimelineButtonHeader self.server.fullWidthTimelineButtonHeader
moderationActionStr = '' moderationActionStr = ''
if '?modaction=' in nickname:
moderationActionStr = \
nickname.split('?modaction=')[1]
nickname = nickname.split('?modaction=')[0]
msg = \ msg = \
htmlModeration(self.server.cssCache, htmlModeration(self.server.cssCache,
self.server.defaultTimeline, self.server.defaultTimeline,
@ -8186,8 +8182,6 @@ class PubServer(BaseHTTPRequestHandler):
if debug: if debug:
nickname = path.replace('/users/', '') nickname = path.replace('/users/', '')
nickname = nickname.replace('/moderation', '') nickname = nickname.replace('/moderation', '')
if '?modaction=' in nickname:
nickname = nickname.split('?modaction=')[0]
print('DEBUG: ' + nickname + print('DEBUG: ' + nickname +
' was not authorized to access ' + path) ' was not authorized to access ' + path)
if debug: if debug:
@ -11004,7 +10998,8 @@ class PubServer(BaseHTTPRequestHandler):
# block a domain from htmlAccountInfo # block a domain from htmlAccountInfo
if authorized and '/users/' in self.path and \ if authorized and '/users/' in self.path and \
'/accountinfo?blockdomain=' in self.path: '/accountinfo?blockdomain=' in self.path and \
'?handle=' in self.path:
nickname = self.path.split('/users/')[1] nickname = self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname = nickname.split('/')[0] nickname = nickname.split('/')[0]
@ -11012,20 +11007,33 @@ class PubServer(BaseHTTPRequestHandler):
self._400() self._400()
return return
blockDomain = self.path.split('/accountinfo?blockdomain=')[1] blockDomain = self.path.split('/accountinfo?blockdomain=')[1]
searchHandle = blockDomain.split('?handle=')[1]
blockDomain = blockDomain.split('?handle=')[0]
blockDomain = urllib.parse.unquote_plus(blockDomain.strip()) blockDomain = urllib.parse.unquote_plus(blockDomain.strip())
searchHandle = ''
if '?' in blockDomain: if '?' in blockDomain:
searchHandle = '?modaction=' + blockDomain.split('?')[1]
blockDomain = blockDomain.split('?')[0] blockDomain = blockDomain.split('?')[0]
addGlobalBlock(self.server.baseDir, nickname, blockDomain) addGlobalBlock(self.server.baseDir, nickname, blockDomain)
self.server.GETbusy = False self.server.GETbusy = False
self._redirect_headers('/users/' + nickname + '/moderation' + msg = \
searchHandle, cookie, callingDomain) htmlAccountInfo(self.server.cssCache,
self.server.translate,
self.server.baseDir,
self.server.httpPrefix,
nickname,
self.server.domain,
self.server.port,
searchHandle,
self.server.debug)
msg = msg.encode('utf-8')
self._login_headers('text/html',
len(msg), callingDomain)
self._write(msg)
return return
# unblock a domain from htmlAccountInfo # unblock a domain from htmlAccountInfo
if authorized and '/users/' in self.path and \ if authorized and '/users/' in self.path and \
'/accountinfo?unblockdomain=' in self.path: '/accountinfo?unblockdomain=' in self.path and \
'?handle=' in self.path:
nickname = self.path.split('/users/')[1] nickname = self.path.split('/users/')[1]
if '/' in nickname: if '/' in nickname:
nickname = nickname.split('/')[0] nickname = nickname.split('/')[0]
@ -11033,15 +11041,25 @@ class PubServer(BaseHTTPRequestHandler):
self._400() self._400()
return return
blockDomain = self.path.split('/accountinfo?unblockdomain=')[1] blockDomain = self.path.split('/accountinfo?unblockdomain=')[1]
searchHandle = blockDomain.split('?handle=')[1]
blockDomain = blockDomain.split('?handle=')[0]
blockDomain = urllib.parse.unquote_plus(blockDomain.strip()) blockDomain = urllib.parse.unquote_plus(blockDomain.strip())
searchHandle = ''
if '?' in blockDomain:
searchHandle = '?modaction=' + blockDomain.split('?')[1]
blockDomain = blockDomain.split('?')[0]
removeGlobalBlock(self.server.baseDir, nickname, blockDomain) removeGlobalBlock(self.server.baseDir, nickname, blockDomain)
self.server.GETbusy = False self.server.GETbusy = False
self._redirect_headers('/users/' + nickname + '/moderation' + msg = \
searchHandle, cookie, callingDomain) htmlAccountInfo(self.server.cssCache,
self.server.translate,
self.server.baseDir,
self.server.httpPrefix,
nickname,
self.server.domain,
self.server.port,
searchHandle,
self.server.debug)
msg = msg.encode('utf-8')
self._login_headers('text/html',
len(msg), callingDomain)
self._write(msg)
return return
# get the bookmarks timeline for a given person # get the bookmarks timeline for a given person

View File

@ -68,11 +68,10 @@ def htmlAccountInfo(cssCache: {}, translate: {},
searchNickname = getNicknameFromActor(searchHandle) searchNickname = getNicknameFromActor(searchHandle)
searchDomain, searchPort = getDomainFromActor(searchHandle) searchDomain, searchPort = getDomainFromActor(searchHandle)
searchHandle = searchNickname + '@' + searchDomain
infoForm += \ infoForm += \
'<center><h1><a href="/users/' + nickname + '/moderation' + \ '<center><h1><a href="/users/' + nickname + '/moderation">' + \
'?modaction=' + searchHandle + '">' + \ translate['Account Information'] + ': ' + searchHandle + \
translate['Account Information'] + \
': ' + searchNickname + '@' + searchDomain + \
'</a></h1><br>' '</a></h1><br>'
infoForm += translate[msgStr1] + '</center><br><br>' infoForm += translate[msgStr1] + '</center><br><br>'
@ -91,12 +90,14 @@ def htmlAccountInfo(cssCache: {}, translate: {},
httpPrefix + '://' + postDomain + '">' + postDomain + '</a> ' httpPrefix + '://' + postDomain + '">' + postDomain + '</a> '
if isBlockedDomain(baseDir, postDomain): if isBlockedDomain(baseDir, postDomain):
infoForm += \ infoForm += \
'<a href="' + usersPath + '?unblockdomain=' + postDomain + '">' '<a href="' + usersPath + '?unblockdomain=' + postDomain + \
'?handle=' + searchHandle + '">'
infoForm += '<button class="buttonhighlighted"><span>' + \ infoForm += '<button class="buttonhighlighted"><span>' + \
translate['Unblock'] + '</span></button></a>' translate['Unblock'] + '</span></button></a>'
else: else:
infoForm += \ infoForm += \
'<a href="' + usersPath + '?blockdomain=' + postDomain + '">' '<a href="' + usersPath + '?blockdomain=' + postDomain + \
'?handle=' + searchHandle + '">'
infoForm += '<button class="button"><span>' + \ infoForm += '<button class="button"><span>' + \
translate['Block'] + '</span></button></a>' translate['Block'] + '</span></button></a>'
infoForm += '<br>' infoForm += '<br>'