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 happening import removeCalendarEvent
from bookmarks import bookmark from bookmarks import bookmark
from bookmarks import undoBookmark from bookmarks import undoBookmark
from petnames import setPetName
import os import os
@ -7593,6 +7594,11 @@ class PubServer(BaseHTTPRequestHandler):
postUrl = optionsConfirmParams.split('postUrl=')[1] postUrl = optionsConfirmParams.split('postUrl=')[1]
if '&' in postUrl: if '&' in postUrl:
postUrl = postUrl.split('&')[0] 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) optionsNickname = getNicknameFromActor(optionsActor)
if not optionsNickname: if not optionsNickname:
@ -7628,6 +7634,18 @@ class PubServer(BaseHTTPRequestHandler):
cookie, callingDomain) cookie, callingDomain)
self.server.POSTbusy = False self.server.POSTbusy = False
return 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 '&submitBlock=' in optionsConfirmParams:
if self.server.debug: if self.server.debug:
print('Adding block by ' + chooserNickname + print('Adding block by ' + chooserNickname +

View File

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