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; } }