Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F8922600
email.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
763 B
Referenced Files
None
Subscribers
None
email.ts
View Options
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
Details
Attached
Mime Type
text/x-java
Expires
Sat, Sep 20, 14:45 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
931332
Default Alt Text
email.ts (763 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment