本文整理匯總了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};
}