本文整理汇总了TypeScript中server/libs/validator.email函数的典型用法代码示例。如果您正苦于以下问题:TypeScript email函数的具体用法?TypeScript email怎么用?TypeScript email使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了email函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isSignupEmailValid
export async function isSignupEmailValid(param : Request.SignupEmail, alreadyExistsAccount : Account, locale : string) : Promise<ValidationResult>
{
const log = slog.stepIn('SignupApi', 'isSignupEmailValid');
const response : Response.SignupEmail = {status:Response.Status.OK, message:{}};
const {email, password} = param;
do
{
// メールアドレス検証
const resultEmail = await Validator.email(email, 0, alreadyExistsAccount, locale);
if (resultEmail.status !== Response.Status.OK)
{
response.status = resultEmail.status;
response.message.email = resultEmail.message;
}
// パスワード検証
const passwordResult = Validator.password({password}, locale);
if (passwordResult.status !== Response.Status.OK)
{
response.status = passwordResult.status;
response.message.password = passwordResult.password;
}
}
while (false);
if (response.status !== Response.Status.OK) {
log.w(JSON.stringify(response, null, 2));
}
log.stepOut();
return {response};
}
示例2: isInviteValid
export async function isInviteValid(param : Request.Invite, alreadyExistsAccount : Account, locale : string) : Promise<ValidationResult>
{
const log = slog.stepIn('SettingsApi', 'isInviteValid');
const response : Response.Invite = {status:Response.Status.OK, message:{}};
const {email} = param;
do
{
// メールアドレス検証
const resultEmail = await Validator.email(email, 0, alreadyExistsAccount, locale);
if (resultEmail.status !== Response.Status.OK)
{
response.status = resultEmail.status;
response.message.email = resultEmail.message;
}
}
while (false);
if (response.status !== Response.Status.OK) {
log.w(JSON.stringify(response, null, 2));
}
log.stepOut();
return {response};
}
示例3: async
test.serial('メールアドレス検証 - ドメインが存在しない時は失敗すること', async (t) =>
{
const log = slog.stepIn('test', t['_test'].title);
const email = 'example@aiueo.com';
const accountId = 123;
const account : Account = {id:123};
const result = await Validator.email(email, accountId, account, locale);
const {status} = result;
log.d(JSON.stringify(result, null, 2));
t.is(status, Response.Status.FAILED);
log.stepOut();
});
示例4: isRequestChangeEmailValid
export async function isRequestChangeEmailValid(param : Request.RequestChangeEmail, myAccount : Account, locale : string) : Promise<ValidationResult>
{
const log = slog.stepIn('SettingsApi', 'isRequestChangeEmailValid');
const response : Response.RequestChangeEmail = {status:Response.Status.OK, message:{}};
const {email} = param;
do
{
if (email)
{
const alreadyExistsAccount = await AccountAgent.findByProviderId('email', email);
const resultEmail = await Validator.email(email, myAccount.id, alreadyExistsAccount, locale);
if (resultEmail.status !== Response.Status.OK)
{
response.status = resultEmail.status;
response.message.email = resultEmail.message;
}
}
else
{
if (AccountAgent.canUnlink(myAccount, 'email') === false)
{
response.status = Response.Status.FAILED;
response.message.email = R.text(R.CANNOT_EMPTY_EMAIL, locale);
}
}
}
while (false);
if (response.status !== Response.Status.OK) {
log.w(JSON.stringify(response, null, 2));
}
log.stepOut();
return {response};
}