Move EMAIL_REGEXP to Validator
This commit is contained in:
parent
27bd7400e2
commit
f6b326f802
@ -1,12 +1,13 @@
|
||||
import crypto from "crypto";
|
||||
import config from "config";
|
||||
import Model, {EMAIL_REGEX} from "../../db/Model";
|
||||
import Model from "../../db/Model";
|
||||
import AuthProof from "../AuthProof";
|
||||
import User from "./User";
|
||||
import argon2 from "argon2";
|
||||
import {WhereTest} from "../../db/ModelQuery";
|
||||
import UserEmail from "./UserEmail";
|
||||
import ModelFactory from "../../db/ModelFactory";
|
||||
import {EMAIL_REGEX} from "../../db/Validator";
|
||||
|
||||
export default class MagicLink extends Model implements AuthProof<User> {
|
||||
public static async bySessionID(sessionID: string, actionType?: string | string[]): Promise<MagicLink | null> {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import User from "./User";
|
||||
import Model, {EMAIL_REGEX} from "../../db/Model";
|
||||
import {OneModelRelation} from "../../db/ModelRelation";
|
||||
import ModelFactory from "../../db/ModelFactory";
|
||||
import {EMAIL_REGEX} from "../../db/Validator";
|
||||
|
||||
export default class UserEmail extends Model {
|
||||
public readonly id?: number = undefined;
|
||||
|
@ -222,5 +222,3 @@ export default abstract class Model {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;
|
||||
|
@ -4,6 +4,8 @@ import {Connection} from "mysql";
|
||||
import {Type} from "../Utils";
|
||||
import {ServerError} from "../HttpError";
|
||||
|
||||
export const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/;
|
||||
|
||||
export default class Validator<T> {
|
||||
private readonly steps: ValidationStep<T>[] = [];
|
||||
private readonly validationAttributes: string[] = [];
|
||||
|
Loading…
Reference in New Issue
Block a user