當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript validator.email函數代碼示例

本文整理匯總了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};
}
開發者ID:nandai,項目名稱:web-service-template,代碼行數:35,代碼來源:onSignupEmail.ts

示例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};
}
開發者ID:nandai,項目名稱:web-service-template,代碼行數:26,代碼來源:onInvite.ts

示例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();
    });
開發者ID:nandai,項目名稱:web-service-template,代碼行數:13,代碼來源:_testEmailValid.ts

示例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};
}
開發者ID:nandai,項目名稱:web-service-template,代碼行數:37,代碼來源:onRequestChangeEmail.ts


注:本文中的server/libs/validator.email函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。