diff --git a/daemon.py b/daemon.py index 977f182e..c5489962 100644 --- a/daemon.py +++ b/daemon.py @@ -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: diff --git a/webinterface.py b/webinterface.py index e3d57a1e..6c88540f 100644 --- a/webinterface.py +++ b/webinterface.py @@ -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='
Welcome. Please enter your login details below.
' + if os.path.isfile(baseDir+'/accounts/login.txt'): + with open(baseDir+'/accounts/login.txt', 'r') as file: + loginText = ''+file.read()+'
' + loginCSS= \ 'body, html {' \ ' height: 100%;' \ @@ -112,7 +117,8 @@ def htmlLogin(baseDir: str) -> str: loginForm+= \ '