Page MenuHomeSealhub

email.ts
No OneTemporary

email.ts

import { Field, Context } from "../../../main.js";
const email =
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
/** Stores an email address. Rejects values not formatted as an email address. Doesn't provide any configuration or advanced filters */
export default class Email extends Field<string> {
typeName = "email";
async isProperValue(context: Context, value: string) {
if (email.test(value) || value === "") {
return Field.valid();
} else {
return Field.invalid(context.app.i18n("invalid_email", [value]));
}
}
async decode(
_: Context,
storage_value: string | null
): Promise<string | null> {
return storage_value;
}
}

File Metadata

Mime Type
text/x-java
Expires
Sat, Sep 20, 14:45 (1 d, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
931332
Default Alt Text
email.ts (763 B)

Event Timeline