From 6a65ec723db95af62fc88e41fac46c24f44deb96 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 15 Nov 2020 15:18:57 +0100 Subject: [PATCH] AuthController: use Validator system for unknown user on login --- src/auth/AuthController.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/auth/AuthController.ts b/src/auth/AuthController.ts index 52bf6f1..6cad640 100644 --- a/src/auth/AuthController.ts +++ b/src/auth/AuthController.ts @@ -6,6 +6,7 @@ import ModelFactory from "../db/ModelFactory"; import User from "./models/User"; import UserPasswordComponent from "./password/UserPasswordComponent"; import UserNameComponent from "./models/UserNameComponent"; +import {UnknownRelationValidationError} from "../db/Validator"; export default class AuthController extends Controller { public getRoutesPrefix(): string { @@ -103,10 +104,9 @@ export default class AuthController extends Controller { } protected async redirectToRegistration(req: Request, res: Response, identifier: string): Promise { - req.flash('register_identifier', identifier); - req.flash('info', `User with identifier "${identifier}" not found.`); - res.redirect(Controller.route('auth', undefined, { - redirect_uri: req.query.redirect_uri?.toString() || undefined, - })); + const error = new UnknownRelationValidationError(User.table, 'identifier'); + error.thingName = 'identifier'; + error.value = identifier; + throw error; } }