From 0f87798ed6cf296b3836961b8d912b4a6b95af50 Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 28 Feb 2020 10:49:35 -0600 Subject: [PATCH] Don't write bad password back out to input Closes #1379. --- src/browser/pages/login.html | 3 --- src/node/app/login.ts | 15 +++++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/browser/pages/login.html b/src/browser/pages/login.html index b9a8bd6d..df6c890b 100644 --- a/src/browser/pages/login.html +++ b/src/browser/pages/login.html @@ -33,12 +33,9 @@
- { + public async getRoot(route: Route, error?: Error): Promise { const response = await this.getUtf8Resource(this.rootPath, "src/browser/pages/login.html") - response.content = response.content - .replace(/{{VALUE}}/, value || "") - .replace(/{{ERROR}}/, error ? `
${error.message}
` : "") + response.content = response.content.replace(/{{ERROR}}/, error ? `
${error.message}
` : "") return this.replaceTemplates(route, response) } @@ -63,15 +61,12 @@ export class LoginHttpProvider extends HttpProvider { return { code: HttpCode.Ok } } - let payload: LoginPayload | undefined try { const data = await this.getData(request) - const p = data ? querystring.parse(data) : {} - payload = p - - return await this.login(p, route, request) + const payload = data ? querystring.parse(data) : {} + return await this.login(payload, route, request) } catch (error) { - return this.getRoot(route, payload ? payload.password : undefined, error) + return this.getRoot(route, error) } }