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