parent
963ebaca5b
commit
0f87798ed6
@ -33,12 +33,9 @@
|
|||||||
<input class="user" type="text" autocomplete="username" />
|
<input class="user" type="text" autocomplete="username" />
|
||||||
<input id="base" type="hidden" name="base" value="/" />
|
<input id="base" type="hidden" name="base" value="/" />
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<!-- The onfocus code places the cursor at the end of the value. -->
|
|
||||||
<input
|
<input
|
||||||
required
|
required
|
||||||
autofocus
|
autofocus
|
||||||
value="{{VALUE}}"
|
|
||||||
onfocus="const value=this.value;this.value='';this.value=value;"
|
|
||||||
class="password"
|
class="password"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="PASSWORD"
|
placeholder="PASSWORD"
|
||||||
|
@ -45,11 +45,9 @@ export class LoginHttpProvider extends HttpProvider {
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getRoot(route: Route, value?: string, error?: Error): Promise<HttpResponse> {
|
public async getRoot(route: Route, error?: Error): Promise<HttpResponse> {
|
||||||
const response = await this.getUtf8Resource(this.rootPath, "src/browser/pages/login.html")
|
const response = await this.getUtf8Resource(this.rootPath, "src/browser/pages/login.html")
|
||||||
response.content = response.content
|
response.content = response.content.replace(/{{ERROR}}/, error ? `<div class="error">${error.message}</div>` : "")
|
||||||
.replace(/{{VALUE}}/, value || "")
|
|
||||||
.replace(/{{ERROR}}/, error ? `<div class="error">${error.message}</div>` : "")
|
|
||||||
return this.replaceTemplates(route, response)
|
return this.replaceTemplates(route, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,15 +61,12 @@ export class LoginHttpProvider extends HttpProvider {
|
|||||||
return { code: HttpCode.Ok }
|
return { code: HttpCode.Ok }
|
||||||
}
|
}
|
||||||
|
|
||||||
let payload: LoginPayload | undefined
|
|
||||||
try {
|
try {
|
||||||
const data = await this.getData(request)
|
const data = await this.getData(request)
|
||||||
const p = data ? querystring.parse(data) : {}
|
const payload = data ? querystring.parse(data) : {}
|
||||||
payload = p
|
return await this.login(payload, route, request)
|
||||||
|
|
||||||
return await this.login(p, route, request)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return this.getRoot(route, payload ? payload.password : undefined, error)
|
return this.getRoot(route, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user