This commit is contained in:
Simon Larsen 2023-09-27 17:00:02 +01:00
parent f510fdae5c
commit 08411211ab
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
2 changed files with 12 additions and 3 deletions

View File

@ -12,7 +12,10 @@ export default class PositiveNumber {
public constructor(positiveNumber: number | string) {
if (typeof positiveNumber === Typeof.String) {
positiveNumber = Number.parseInt(positiveNumber.toString().trim(), 10);
positiveNumber = Number.parseInt(
positiveNumber.toString().trim(),
10
);
if (isNaN(positiveNumber)) {
throw new BadDataException(`Invalid number: ${positiveNumber}`);
}

View File

@ -186,7 +186,9 @@ router.post(
const alreadySavedUser: StatusPagePrivateUser | null =
await StatusPagePrivateUserService.findOneBy({
query: {
statusPageId: new ObjectID(data['statusPageId'].toString()),
statusPageId: new ObjectID(
data['statusPageId'].toString()
),
resetPasswordToken:
(user.resetPasswordToken as string) || '',
},
@ -340,7 +342,11 @@ router.post(
const alreadySavedUser: StatusPagePrivateUser | null =
await StatusPagePrivateUserService.findOneBy({
query: { email: user.email!, password: user.password!, statusPageId: user.statusPageId! },
query: {
email: user.email!,
password: user.password!,
statusPageId: user.statusPageId!,
},
select: {
_id: true,
password: true,