2016-01-12 60 views

回答

0

這是我用來驗證郵件是否已經使用exists.I這段代碼的驗證event.The需要檢查「把」方法代碼,以防止用戶更改電子郵件ID的東西,已經在註冊後存在。

function validate(result, field) { 
    if (method === 'PUT') { 
     if (result.length === 0) { 
     } else if (!(result.length === 1 && result[0].id === id)) { 
      error(field, field + " is already in use"); 
     } 
    } else if (result.length !== 0) { 
     error(field, field + " is already in use"); 
    } 
} 
if (!internal) { 
    var email; 
    var method = ctx.method; 
    email = { 
     "email": this.email 
    }; 
    dpd.users.get(email, function (result) { 
     validate(result, "email"); 
    }); 
} 
相關問題