AuthController: use Validator system for unknown user on login
This commit is contained in:
parent
6eacfdcffa
commit
6a65ec723d
@ -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<void> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user