Login text

master
Bob Mottram 2019-07-25 20:22:19 +01:00
parent 7a4a686d87
commit 37a56aed87
2 changed files with 11 additions and 4 deletions

View File

@ -1044,10 +1044,11 @@ class PubServer(BaseHTTPRequestHandler):
del self.server.tokensLookup[self.server.tokens[loginNickname]]
del self.server.tokens[loginNickname]
del self.server.salts[loginNickname]
self.send_response(401)
self.send_response(303)
self.send_header('Content-type', 'text/html; charset=utf-8')
self.send_header('Set-Cookie', 'epicyon=; SameSite=Strict')
self.end_headers()
self.send_header('Location', '/login')
self.end_headers()
self.server.POSTbusy=False
return
else:

View File

@ -41,7 +41,12 @@ def htmlGetLoginCredentials(loginParams: str,lastLoginTime: int) -> (str,str):
def htmlLogin(baseDir: str) -> str:
if not os.path.isfile(baseDir+'/accounts/login.png'):
copyfile(baseDir+'/img/login.png',baseDir+'/accounts/login.png')
# /login?nickname=[username]&password=[password]&remember=on
loginText='<p>Welcome. Please enter your login details below.</p>'
if os.path.isfile(baseDir+'/accounts/login.txt'):
with open(baseDir+'/accounts/login.txt', 'r') as file:
loginText = '<p>'+file.read()+'</p>'
loginCSS= \
'body, html {' \
' height: 100%;' \
@ -112,7 +117,8 @@ def htmlLogin(baseDir: str) -> str:
loginForm+= \
' <form method="POST" action="/login">' \
' <div class="imgcontainer">' \
' <img src="login.png" alt="login image" class="loginimage">' \
' <img src="login.png" alt="login image" class="loginimage">'+ \
loginText+ \
' </div>' \
'' \
' <div class="container">' \