Create helper for determining if route is the root
This commit is contained in:
@@ -18,8 +18,7 @@ interface LoginPayload {
|
||||
*/
|
||||
export class LoginHttpProvider extends HttpProvider {
|
||||
public async handleRequest(route: Route, request: http.IncomingMessage): Promise<HttpResponse> {
|
||||
// Only serve root pages and only if password authentication is enabled.
|
||||
if (this.options.auth !== AuthType.Password || (route.requestPath && route.requestPath !== "/index.html")) {
|
||||
if (this.options.auth !== AuthType.Password || !this.isRoot(route)) {
|
||||
throw new HttpError("Not found", HttpCode.NotFound)
|
||||
}
|
||||
switch (route.base) {
|
||||
|
||||
Reference in New Issue
Block a user