mirror of https://gitlab.com/bashrc2/epicyon
Move edit profile screen to its own method
parent
38f9f91664
commit
2a2279b05c
38
daemon.py
38
daemon.py
|
@ -7180,6 +7180,28 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _editProfile(self, callingDomain: str, path: str,
|
||||||
|
translate: {}, baseDir: str,
|
||||||
|
httpPrefix: str, domain: str, port: int,
|
||||||
|
cookie: str) -> bool:
|
||||||
|
"""Show the edit profile screen
|
||||||
|
"""
|
||||||
|
if '/users/' in path and path.endswith('/editprofile'):
|
||||||
|
msg = htmlEditProfile(translate,
|
||||||
|
baseDir,
|
||||||
|
path, domain,
|
||||||
|
port,
|
||||||
|
httpPrefix).encode('utf-8')
|
||||||
|
if msg:
|
||||||
|
self._set_headers('text/html', len(msg),
|
||||||
|
cookie, callingDomain)
|
||||||
|
self._write(msg)
|
||||||
|
else:
|
||||||
|
self._404()
|
||||||
|
self.server.GETbusy = False
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
callingDomain = self.server.domainFull
|
callingDomain = self.server.domainFull
|
||||||
if self.headers.get('Host'):
|
if self.headers.get('Host'):
|
||||||
|
@ -8434,19 +8456,13 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
# edit profile in web interface
|
# edit profile in web interface
|
||||||
if '/users/' in self.path and self.path.endswith('/editprofile'):
|
if self._editProfile(callingDomain, self.path,
|
||||||
msg = htmlEditProfile(self.server.translate,
|
self.server.translate,
|
||||||
self.server.baseDir,
|
self.server.baseDir,
|
||||||
self.path, self.server.domain,
|
self.server.httpPrefix,
|
||||||
|
self.server.domain,
|
||||||
self.server.port,
|
self.server.port,
|
||||||
self.server.httpPrefix).encode('utf-8')
|
cookie):
|
||||||
if msg:
|
|
||||||
self._set_headers('text/html', len(msg),
|
|
||||||
cookie, callingDomain)
|
|
||||||
self._write(msg)
|
|
||||||
else:
|
|
||||||
self._404()
|
|
||||||
self.server.GETbusy = False
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if self._showNewPost(callingDomain, self.path,
|
if self._showNewPost(callingDomain, self.path,
|
||||||
|
|
Loading…
Reference in New Issue