Set petname from person options

main
Bob Mottram 2020-06-29 17:53:02 +01:00
parent 46b1eea06a
commit b466e33304
2 changed files with 21 additions and 1 deletions

View File

@ -184,6 +184,7 @@ from outbox import postMessageToOutbox
from happening import removeCalendarEvent
from bookmarks import bookmark
from bookmarks import undoBookmark
from petnames import setPetName
import os
@ -7593,6 +7594,11 @@ class PubServer(BaseHTTPRequestHandler):
postUrl = optionsConfirmParams.split('postUrl=')[1]
if '&' in postUrl:
postUrl = postUrl.split('&')[0]
petname = None
if 'optionpetname' in optionsConfirmParams:
petname = optionsConfirmParams.split('optionpetname=')[1]
if '&' in petname:
petname = petname.split('&')[0]
optionsNickname = getNicknameFromActor(optionsActor)
if not optionsNickname:
@ -7628,6 +7634,18 @@ class PubServer(BaseHTTPRequestHandler):
cookie, callingDomain)
self.server.POSTbusy = False
return
if '&submitPetname=' in optionsConfirmParams and petname:
if self.server.debug:
print('Change petname to ' + petname)
handle = optionsNickname + '@' + optionsDomainFull
setPetName(self.server.baseDir,
chooserNickname,
self.server.domain,
handle, petname)
self._redirect_headers(optionsActor,
cookie, callingDomain)
self.server.POSTbusy = False
return
if '&submitBlock=' in optionsConfirmParams:
if self.server.debug:
print('Adding block by ' + chooserNickname +

View File

@ -5420,7 +5420,9 @@ def htmlPersonOptions(translate: {}, baseDir: str,
optionsStr += \
'<p>' + translate['Petname'] + ': ' + \
'<input type="text" name="optionpetname" value="' + \
petname + '"></p>'
petname + '">' \
'<button type="submit" class="button" name="submitPetname">' + \
translate['Submit'] + '</button></p>'
optionsStr += optionsLinkStr
optionsStr += \
' <button type="submit" class="button" name="submitView">' + \