forked from indymedia/epicyon
Upgrade actor on login
parent
d30d519d22
commit
2bac46cfb4
|
@ -36,6 +36,7 @@ from matrix import getMatrixAddress
|
|||
from matrix import setMatrixAddress
|
||||
from donate import getDonationUrl
|
||||
from donate import setDonationUrl
|
||||
from person import personUpgradeActor
|
||||
from person import activateAccount
|
||||
from person import deactivateAccount
|
||||
from person import registerAccount
|
||||
|
@ -3911,15 +3912,19 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
token=sha256((loginNickname+loginPassword+salt).encode('utf-8')).hexdigest()
|
||||
self.server.tokens[loginNickname]=token
|
||||
loginHandle=loginNickname+'@'+self.server.domain
|
||||
tokenFilename= \
|
||||
self.server.baseDir+'/accounts/'+ \
|
||||
loginNickname+'@'+self.server.domain+'/.token'
|
||||
loginHandle+'/.token'
|
||||
try:
|
||||
with open(tokenFilename, 'w') as fp:
|
||||
fp.write(token)
|
||||
except Exception as e:
|
||||
print('WARN: Unable to save token for '+loginNickname+' '+str(e))
|
||||
|
||||
personUpgradeActor(None,loginHandle, \
|
||||
self.server.baseDir+'/accounts/'+loginHandle+'.json')
|
||||
|
||||
self.server.tokensLookup[self.server.tokens[loginNickname]]=loginNickname
|
||||
self.send_header('Set-Cookie', \
|
||||
'epicyon='+self.server.tokens[loginNickname]+'; SameSite=Strict')
|
||||
|
|
|
@ -376,6 +376,8 @@ def createCapabilitiesInbox(baseDir: str,nickname: str,domain: str,port: int, \
|
|||
def personUpgradeActor(personJson: {},handle: str,filename: str) -> None:
|
||||
"""Alter the actor to add any new properties
|
||||
"""
|
||||
if not personJson:
|
||||
personJson=loadJson(filename)
|
||||
if not personJson.get('nomadicLocations'):
|
||||
personJson['nomadicLocations']=[{
|
||||
'id': personJson['id'],
|
||||
|
|
Loading…
Reference in New Issue