PasswordAuthMethod: simplify bad password throw
This commit is contained in:
parent
f99c62a5d9
commit
35129cd4f1
@ -7,7 +7,7 @@ import AuthComponent from "../AuthComponent";
|
||||
import Application from "../../Application";
|
||||
import Throttler from "../../Throttler";
|
||||
import {AuthError, PendingApprovalAuthError, RegisterCallback} from "../AuthGuard";
|
||||
import Validator, {InvalidFormatValidationError, ValidationBag} from "../../db/Validator";
|
||||
import Validator, {InvalidFormatValidationError} from "../../db/Validator";
|
||||
import Controller from "../../Controller";
|
||||
import UserPasswordComponent from "./UserPasswordComponent";
|
||||
import UserNameComponent, {USERNAME_REGEXP} from "../models/UserNameComponent";
|
||||
@ -64,11 +64,9 @@ export default class PasswordAuthMethod implements AuthMethod<PasswordAuthProof>
|
||||
res.redirectBack();
|
||||
return;
|
||||
} else {
|
||||
const bag = new ValidationBag();
|
||||
const err = new InvalidFormatValidationError('Invalid password.');
|
||||
err.thingName = 'password';
|
||||
bag.addMessage(err);
|
||||
throw bag;
|
||||
throw err;
|
||||
}
|
||||
} else {
|
||||
throw e;
|
||||
|
Loading…
Reference in New Issue
Block a user